@antebudimir/eslint-plugin-vanilla-extract 1.1.0 → 1.1.1
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/dist/index.js +1 -1
- package/package.json +4 -2
- package/dist/cjs/css-rules/alphabetical-order/index.d.ts +0 -2
- package/dist/cjs/css-rules/alphabetical-order/index.js +0 -7
- package/dist/cjs/css-rules/alphabetical-order/property-order-enforcer.d.ts +0 -14
- package/dist/cjs/css-rules/alphabetical-order/property-order-enforcer.js +0 -60
- package/dist/cjs/css-rules/alphabetical-order/recipe-order-enforcer.d.ts +0 -14
- package/dist/cjs/css-rules/alphabetical-order/recipe-order-enforcer.js +0 -25
- package/dist/cjs/css-rules/alphabetical-order/rule-definition.d.ts +0 -3
- package/dist/cjs/css-rules/alphabetical-order/rule-definition.js +0 -22
- package/dist/cjs/css-rules/alphabetical-order/style-object-processor.d.ts +0 -15
- package/dist/cjs/css-rules/alphabetical-order/style-object-processor.js +0 -32
- package/dist/cjs/css-rules/concentric-order/concentric-groups.d.ts +0 -7
- package/dist/cjs/css-rules/concentric-order/concentric-groups.js +0 -310
- package/dist/cjs/css-rules/concentric-order/index.d.ts +0 -2
- package/dist/cjs/css-rules/concentric-order/index.js +0 -7
- package/dist/cjs/css-rules/concentric-order/property-order-enforcer.d.ts +0 -16
- package/dist/cjs/css-rules/concentric-order/property-order-enforcer.js +0 -64
- package/dist/cjs/css-rules/concentric-order/recipe-order-enforcer.d.ts +0 -14
- package/dist/cjs/css-rules/concentric-order/recipe-order-enforcer.js +0 -25
- package/dist/cjs/css-rules/concentric-order/rule-definition.d.ts +0 -3
- package/dist/cjs/css-rules/concentric-order/rule-definition.js +0 -22
- package/dist/cjs/css-rules/concentric-order/style-object-processor.d.ts +0 -21
- package/dist/cjs/css-rules/concentric-order/style-object-processor.js +0 -63
- package/dist/cjs/css-rules/concentric-order/types.d.ts +0 -8
- package/dist/cjs/css-rules/concentric-order/types.js +0 -2
- package/dist/cjs/css-rules/custom-order/property-order-enforcer.d.ts +0 -17
- package/dist/cjs/css-rules/custom-order/property-order-enforcer.js +0 -71
- package/dist/cjs/css-rules/custom-order/recipe-order-enforcer.d.ts +0 -16
- package/dist/cjs/css-rules/custom-order/recipe-order-enforcer.js +0 -27
- package/dist/cjs/css-rules/custom-order/rule-definition.d.ts +0 -3
- package/dist/cjs/css-rules/custom-order/rule-definition.js +0 -42
- package/dist/cjs/css-rules/custom-order/style-object-processor.d.ts +0 -19
- package/dist/cjs/css-rules/custom-order/style-object-processor.js +0 -56
- package/dist/cjs/css-rules/shared-utils/css-order-fixer.d.ts +0 -17
- package/dist/cjs/css-rules/shared-utils/css-order-fixer.js +0 -43
- package/dist/cjs/css-rules/shared-utils/css-property-priority-map.d.ts +0 -25
- package/dist/cjs/css-rules/shared-utils/css-property-priority-map.js +0 -52
- package/dist/cjs/css-rules/shared-utils/nested-selectors-processor.d.ts +0 -25
- package/dist/cjs/css-rules/shared-utils/nested-selectors-processor.js +0 -40
- package/dist/cjs/css-rules/shared-utils/order-strategy-visitor-creator.d.ts +0 -17
- package/dist/cjs/css-rules/shared-utils/order-strategy-visitor-creator.js +0 -79
- package/dist/cjs/css-rules/shared-utils/property-separator.d.ts +0 -28
- package/dist/cjs/css-rules/shared-utils/property-separator.js +0 -53
- package/dist/cjs/css-rules/shared-utils/recipe-property-processor.d.ts +0 -16
- package/dist/cjs/css-rules/shared-utils/recipe-property-processor.js +0 -40
- package/dist/cjs/css-rules/shared-utils/style-node-processor.d.ts +0 -9
- package/dist/cjs/css-rules/shared-utils/style-node-processor.js +0 -25
- package/dist/cjs/css-sample/sample.css.d.ts +0 -161
- package/dist/cjs/css-sample/sample.css.js +0 -554
- package/dist/cjs/index.d.ts +0 -38
- package/dist/cjs/index.js +0 -43
- package/dist/css/test.css.d.ts +0 -159
- package/dist/css/test.css.js +0 -468
- package/dist/css/testFileForOtherMethods.css.d.ts +0 -3
- package/dist/css/testFileForOtherMethods.css.js +0 -101
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import customOrderRule from './css-rules/custom-order/rule-definition.js';
|
|
|
4
4
|
export const vanillaExtract = {
|
|
5
5
|
meta: {
|
|
6
6
|
name: '@antebudimir/eslint-plugin-vanilla-extract',
|
|
7
|
-
version: '1.1.
|
|
7
|
+
version: '1.1.1',
|
|
8
8
|
},
|
|
9
9
|
rules: {
|
|
10
10
|
'alphabetical-order': alphabeticalOrderRule,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antebudimir/eslint-plugin-vanilla-extract",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "ESLint plugin for enforcing CSS ordering in vanilla-extract styles",
|
|
5
5
|
"author": "Ante Budimir",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
|
-
"dist"
|
|
38
|
+
"dist",
|
|
39
|
+
"LICENSE",
|
|
40
|
+
"README.md"
|
|
39
41
|
],
|
|
40
42
|
"engines": {
|
|
41
43
|
"node": ">=18.18.0"
|
|
@@ -1,7 +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
|
-
const rule_definition_js_1 = __importDefault(require("./rule-definition.js"));
|
|
7
|
-
exports.default = rule_definition_js_1.default;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Rule } from 'eslint';
|
|
2
|
-
import { TSESTree } from '@typescript-eslint/utils';
|
|
3
|
-
/**
|
|
4
|
-
* Enforces alphabetical ordering of CSS properties.
|
|
5
|
-
* @param ruleContext The ESLint rule context.
|
|
6
|
-
* @param regularProperties An array of regular CSS properties to be checked.
|
|
7
|
-
*
|
|
8
|
-
* This function does the following:
|
|
9
|
-
* 1. Checks if there are enough properties to compare (more than 1).
|
|
10
|
-
* 2. Creates pairs of consecutive properties for comparison.
|
|
11
|
-
* 3. Finds the first pair that violates alphabetical order.
|
|
12
|
-
* 4. If a violation is found, reports the issue and generates fixes.
|
|
13
|
-
*/
|
|
14
|
-
export declare const enforceAlphabeticalCSSOrder: (ruleContext: Rule.RuleContext, regularProperties: TSESTree.Property[]) => void;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enforceAlphabeticalCSSOrder = void 0;
|
|
4
|
-
const css_order_fixer_js_1 = require("../shared-utils/css-order-fixer.js");
|
|
5
|
-
const property_separator_js_1 = require("../shared-utils/property-separator.js");
|
|
6
|
-
/**
|
|
7
|
-
* Compares two CSS properties alphabetically.
|
|
8
|
-
* @param firstProperty The first property to compare.
|
|
9
|
-
* @param secondProperty The second property to compare.
|
|
10
|
-
* @returns A number indicating the relative order of the properties (-1, 0, or 1).
|
|
11
|
-
*/
|
|
12
|
-
const comparePropertiesAlphabetically = (firstProperty, secondProperty) => {
|
|
13
|
-
const firstName = (0, property_separator_js_1.getPropertyName)(firstProperty);
|
|
14
|
-
const secondName = (0, property_separator_js_1.getPropertyName)(secondProperty);
|
|
15
|
-
return firstName.localeCompare(secondName);
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Reports an ordering issue to ESLint and generates fixes.
|
|
19
|
-
* @param ruleContext The ESLint rule context.
|
|
20
|
-
* @param currentProperty The current property in the order.
|
|
21
|
-
* @param nextProperty The next property that is out of order.
|
|
22
|
-
* @param regularProperties The full list of regular properties to be reordered.
|
|
23
|
-
*/
|
|
24
|
-
const reportOrderingIssue = (ruleContext, currentProperty, nextProperty, regularProperties) => {
|
|
25
|
-
ruleContext.report({
|
|
26
|
-
node: nextProperty,
|
|
27
|
-
messageId: 'alphabeticalOrder',
|
|
28
|
-
data: {
|
|
29
|
-
nextProperty: (0, property_separator_js_1.getPropertyName)(nextProperty),
|
|
30
|
-
currentProperty: (0, property_separator_js_1.getPropertyName)(currentProperty),
|
|
31
|
-
},
|
|
32
|
-
fix: (fixer) => (0, css_order_fixer_js_1.generateFixesForCSSOrder)(fixer, ruleContext, regularProperties, comparePropertiesAlphabetically, (property) => property),
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Enforces alphabetical ordering of CSS properties.
|
|
37
|
-
* @param ruleContext The ESLint rule context.
|
|
38
|
-
* @param regularProperties An array of regular CSS properties to be checked.
|
|
39
|
-
*
|
|
40
|
-
* This function does the following:
|
|
41
|
-
* 1. Checks if there are enough properties to compare (more than 1).
|
|
42
|
-
* 2. Creates pairs of consecutive properties for comparison.
|
|
43
|
-
* 3. Finds the first pair that violates alphabetical order.
|
|
44
|
-
* 4. If a violation is found, reports the issue and generates fixes.
|
|
45
|
-
*/
|
|
46
|
-
const enforceAlphabeticalCSSOrder = (ruleContext, regularProperties) => {
|
|
47
|
-
if (regularProperties.length <= 1) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
// Create pairs of consecutive properties
|
|
51
|
-
const propertyPairs = regularProperties.slice(0, -1).map((currentProperty, index) => ({
|
|
52
|
-
currentProperty,
|
|
53
|
-
nextProperty: regularProperties[index + 1],
|
|
54
|
-
}));
|
|
55
|
-
const violatingPair = propertyPairs.find(({ currentProperty, nextProperty }) => comparePropertiesAlphabetically(currentProperty, nextProperty) > 0);
|
|
56
|
-
if (violatingPair) {
|
|
57
|
-
reportOrderingIssue(ruleContext, violatingPair.currentProperty, violatingPair.nextProperty, regularProperties);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
exports.enforceAlphabeticalCSSOrder = enforceAlphabeticalCSSOrder;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Rule } from 'eslint';
|
|
2
|
-
import { TSESTree } from '@typescript-eslint/utils';
|
|
3
|
-
/**
|
|
4
|
-
* Enforces alphabetical ordering of CSS properties within a recipe function call.
|
|
5
|
-
*
|
|
6
|
-
* @param node The CallExpression node representing the recipe function call.
|
|
7
|
-
* @param context The ESLint rule context.
|
|
8
|
-
*
|
|
9
|
-
* This function does the following:
|
|
10
|
-
* 1. Checks if the first argument of the recipe function is an ObjectExpression.
|
|
11
|
-
* 2. If valid, processes the recipe object's properties.
|
|
12
|
-
* 3. For each relevant property (e.g., 'base', 'variants'), it applies alphabetical ordering to the CSS properties.
|
|
13
|
-
*/
|
|
14
|
-
export declare const enforceAlphabeticalCSSOrderInRecipe: (node: TSESTree.CallExpression, context: Rule.RuleContext) => void;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enforceAlphabeticalCSSOrderInRecipe = void 0;
|
|
4
|
-
const recipe_property_processor_js_1 = require("../shared-utils/recipe-property-processor.js");
|
|
5
|
-
const style_node_processor_js_1 = require("../shared-utils/style-node-processor.js");
|
|
6
|
-
const style_object_processor_js_1 = require("./style-object-processor.js");
|
|
7
|
-
/**
|
|
8
|
-
* Enforces alphabetical ordering of CSS properties within a recipe function call.
|
|
9
|
-
*
|
|
10
|
-
* @param node The CallExpression node representing the recipe function call.
|
|
11
|
-
* @param context The ESLint rule context.
|
|
12
|
-
*
|
|
13
|
-
* This function does the following:
|
|
14
|
-
* 1. Checks if the first argument of the recipe function is an ObjectExpression.
|
|
15
|
-
* 2. If valid, processes the recipe object's properties.
|
|
16
|
-
* 3. For each relevant property (e.g., 'base', 'variants'), it applies alphabetical ordering to the CSS properties.
|
|
17
|
-
*/
|
|
18
|
-
const enforceAlphabeticalCSSOrderInRecipe = (node, context) => {
|
|
19
|
-
if (!node.arguments[0] || node.arguments[0].type !== 'ObjectExpression') {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const recipeObject = node.arguments[0];
|
|
23
|
-
(0, recipe_property_processor_js_1.processRecipeProperties)(context, recipeObject, (context, object) => (0, style_node_processor_js_1.processStyleNode)(context, object, style_object_processor_js_1.enforceAlphabeticalCSSOrderInStyleObject));
|
|
24
|
-
};
|
|
25
|
-
exports.enforceAlphabeticalCSSOrderInRecipe = enforceAlphabeticalCSSOrderInRecipe;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const order_strategy_visitor_creator_js_1 = require("../shared-utils/order-strategy-visitor-creator.js");
|
|
4
|
-
const alphabeticalOrderRule = {
|
|
5
|
-
meta: {
|
|
6
|
-
type: 'suggestion',
|
|
7
|
-
docs: {
|
|
8
|
-
description: 'enforce alphabetical CSS property ordering in vanilla-extract styles',
|
|
9
|
-
category: 'Stylistic Issues',
|
|
10
|
-
recommended: true,
|
|
11
|
-
},
|
|
12
|
-
fixable: 'code',
|
|
13
|
-
schema: [],
|
|
14
|
-
messages: {
|
|
15
|
-
alphabeticalOrder: "Property '{{next}}' should come before '{{current}}' in alphabetical order.",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
create(context) {
|
|
19
|
-
return (0, order_strategy_visitor_creator_js_1.createNodeVisitors)(context, 'alphabetical');
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
exports.default = alphabeticalOrderRule;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Rule } from 'eslint';
|
|
2
|
-
import { TSESTree } from '@typescript-eslint/utils';
|
|
3
|
-
/**
|
|
4
|
-
* Processes a style object to enforce alphabetical ordering of CSS properties.
|
|
5
|
-
*
|
|
6
|
-
* This function handles different types of style objects:
|
|
7
|
-
* 1. If the object is invalid or not an ObjectExpression, it returns immediately.
|
|
8
|
-
* 2. For 'selectors' objects, it processes nested selectors recursively.
|
|
9
|
-
* 3. For regular style objects, it separates and enforces alphabetical order on properties.
|
|
10
|
-
* 4. It always processes nested objects recursively, regardless of type.
|
|
11
|
-
*
|
|
12
|
-
* @param ruleContext - The ESLint rule context for reporting and fixing issues.
|
|
13
|
-
* @param styleObject - The object expression representing the style object to be processed.
|
|
14
|
-
*/
|
|
15
|
-
export declare const enforceAlphabeticalCSSOrderInStyleObject: (ruleContext: Rule.RuleContext, styleObject: TSESTree.ObjectExpression) => void;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enforceAlphabeticalCSSOrderInStyleObject = void 0;
|
|
4
|
-
const utils_1 = require("@typescript-eslint/utils");
|
|
5
|
-
const nested_selectors_processor_js_1 = require("../shared-utils/nested-selectors-processor.js");
|
|
6
|
-
const property_separator_js_1 = require("../shared-utils/property-separator.js");
|
|
7
|
-
const property_order_enforcer_js_1 = require("./property-order-enforcer.js");
|
|
8
|
-
/**
|
|
9
|
-
* Processes a style object to enforce alphabetical ordering of CSS properties.
|
|
10
|
-
*
|
|
11
|
-
* This function handles different types of style objects:
|
|
12
|
-
* 1. If the object is invalid or not an ObjectExpression, it returns immediately.
|
|
13
|
-
* 2. For 'selectors' objects, it processes nested selectors recursively.
|
|
14
|
-
* 3. For regular style objects, it separates and enforces alphabetical order on properties.
|
|
15
|
-
* 4. It always processes nested objects recursively, regardless of type.
|
|
16
|
-
*
|
|
17
|
-
* @param ruleContext - The ESLint rule context for reporting and fixing issues.
|
|
18
|
-
* @param styleObject - The object expression representing the style object to be processed.
|
|
19
|
-
*/
|
|
20
|
-
const enforceAlphabeticalCSSOrderInStyleObject = (ruleContext, styleObject) => {
|
|
21
|
-
if (!styleObject || styleObject.type !== utils_1.AST_NODE_TYPES.ObjectExpression) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if ((0, nested_selectors_processor_js_1.isSelectorsObject)(styleObject)) {
|
|
25
|
-
(0, nested_selectors_processor_js_1.processNestedSelectors)(ruleContext, styleObject, exports.enforceAlphabeticalCSSOrderInStyleObject);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const { regularProperties } = (0, property_separator_js_1.separateProperties)(styleObject.properties);
|
|
29
|
-
(0, property_order_enforcer_js_1.enforceAlphabeticalCSSOrder)(ruleContext, regularProperties);
|
|
30
|
-
(0, nested_selectors_processor_js_1.processNestedSelectors)(ruleContext, styleObject, exports.enforceAlphabeticalCSSOrderInStyleObject);
|
|
31
|
-
};
|
|
32
|
-
exports.enforceAlphabeticalCSSOrderInStyleObject = enforceAlphabeticalCSSOrderInStyleObject;
|
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.availableGroups = exports.concentricGroups = void 0;
|
|
4
|
-
// CSS property groups in order of importance (outside -> inside)
|
|
5
|
-
exports.concentricGroups = {
|
|
6
|
-
boxSizing: ['all', 'box-sizing', 'aspect-ratio', 'contain'],
|
|
7
|
-
position: [
|
|
8
|
-
'position',
|
|
9
|
-
'z-index',
|
|
10
|
-
'top',
|
|
11
|
-
'right',
|
|
12
|
-
'bottom',
|
|
13
|
-
'left',
|
|
14
|
-
'offset',
|
|
15
|
-
'offset-path',
|
|
16
|
-
'offset-distance',
|
|
17
|
-
'offset-rotate',
|
|
18
|
-
'inset',
|
|
19
|
-
'inset-block',
|
|
20
|
-
'inset-block-start',
|
|
21
|
-
'inset-block-end',
|
|
22
|
-
'inset-inline',
|
|
23
|
-
'inset-inline-start',
|
|
24
|
-
'inset-inline-end',
|
|
25
|
-
],
|
|
26
|
-
display: ['display', 'float', 'clear', 'isolation', 'appearance'],
|
|
27
|
-
flex: ['flex', 'flex-basis', 'flex-direction', 'flex-flow', 'flex-grow', 'flex-shrink', 'flex-wrap'],
|
|
28
|
-
grid: [
|
|
29
|
-
'grid',
|
|
30
|
-
'grid-area',
|
|
31
|
-
'grid-template',
|
|
32
|
-
'grid-template-areas',
|
|
33
|
-
'grid-template-rows',
|
|
34
|
-
'grid-template-columns',
|
|
35
|
-
'grid-row',
|
|
36
|
-
'grid-row-start',
|
|
37
|
-
'grid-row-end',
|
|
38
|
-
'grid-column',
|
|
39
|
-
'grid-column-start',
|
|
40
|
-
'grid-column-end',
|
|
41
|
-
'grid-auto-rows',
|
|
42
|
-
'grid-auto-columns',
|
|
43
|
-
'grid-auto-flow',
|
|
44
|
-
'grid-gap',
|
|
45
|
-
'grid-row-gap',
|
|
46
|
-
'grid-column-gap',
|
|
47
|
-
],
|
|
48
|
-
alignment: [
|
|
49
|
-
'align-content',
|
|
50
|
-
'align-items',
|
|
51
|
-
'align-self',
|
|
52
|
-
'justify-content',
|
|
53
|
-
'justify-items',
|
|
54
|
-
'justify-self',
|
|
55
|
-
'place-content',
|
|
56
|
-
'place-items',
|
|
57
|
-
'place-self',
|
|
58
|
-
'order',
|
|
59
|
-
'gap',
|
|
60
|
-
'row-gap',
|
|
61
|
-
'column-gap',
|
|
62
|
-
],
|
|
63
|
-
columns: [
|
|
64
|
-
'columns',
|
|
65
|
-
'column-fill',
|
|
66
|
-
'column-rule',
|
|
67
|
-
'column-rule-width',
|
|
68
|
-
'column-rule-style',
|
|
69
|
-
'column-rule-color',
|
|
70
|
-
'column-span',
|
|
71
|
-
'column-count',
|
|
72
|
-
'column-width',
|
|
73
|
-
],
|
|
74
|
-
transform: [
|
|
75
|
-
'backface-visibility',
|
|
76
|
-
'perspective',
|
|
77
|
-
'perspective-origin',
|
|
78
|
-
'transform',
|
|
79
|
-
'transform-origin',
|
|
80
|
-
'transform-style',
|
|
81
|
-
'transform-box',
|
|
82
|
-
],
|
|
83
|
-
transitions: [
|
|
84
|
-
'transition',
|
|
85
|
-
'transition-delay',
|
|
86
|
-
'transition-duration',
|
|
87
|
-
'transition-property',
|
|
88
|
-
'transition-timing-function',
|
|
89
|
-
'transition-behavior',
|
|
90
|
-
],
|
|
91
|
-
visibility: [
|
|
92
|
-
'visibility',
|
|
93
|
-
'opacity',
|
|
94
|
-
'backdrop-filter',
|
|
95
|
-
'content-visibility',
|
|
96
|
-
'filter',
|
|
97
|
-
'mix-blend-mode',
|
|
98
|
-
'will-change',
|
|
99
|
-
],
|
|
100
|
-
shape: ['clip-path', 'shape-outside', 'shape-image-threshold', 'shape-margin'],
|
|
101
|
-
margin: [
|
|
102
|
-
'margin',
|
|
103
|
-
'margin-top',
|
|
104
|
-
'margin-right',
|
|
105
|
-
'margin-bottom',
|
|
106
|
-
'margin-left',
|
|
107
|
-
'margin-block',
|
|
108
|
-
'margin-block-start',
|
|
109
|
-
'margin-block-end',
|
|
110
|
-
'margin-inline',
|
|
111
|
-
'margin-inline-start',
|
|
112
|
-
'margin-inline-end',
|
|
113
|
-
'margin-trim',
|
|
114
|
-
],
|
|
115
|
-
outline: ['outline', 'outline-offset', 'outline-width', 'outline-style', 'outline-color'],
|
|
116
|
-
border: [
|
|
117
|
-
'border',
|
|
118
|
-
'border-top',
|
|
119
|
-
'border-right',
|
|
120
|
-
'border-bottom',
|
|
121
|
-
'border-left',
|
|
122
|
-
'border-width',
|
|
123
|
-
'border-top-width',
|
|
124
|
-
'border-right-width',
|
|
125
|
-
'border-bottom-width',
|
|
126
|
-
'border-left-width',
|
|
127
|
-
'border-style',
|
|
128
|
-
'border-top-style',
|
|
129
|
-
'border-right-style',
|
|
130
|
-
'border-bottom-style',
|
|
131
|
-
'border-left-style',
|
|
132
|
-
'border-radius',
|
|
133
|
-
'border-top-left-radius',
|
|
134
|
-
'border-top-right-radius',
|
|
135
|
-
'border-bottom-left-radius',
|
|
136
|
-
'border-bottom-right-radius',
|
|
137
|
-
'border-start-start-radius',
|
|
138
|
-
'border-start-end-radius',
|
|
139
|
-
'border-end-start-radius',
|
|
140
|
-
'border-end-end-radius',
|
|
141
|
-
'border-color',
|
|
142
|
-
'border-top-color',
|
|
143
|
-
'border-right-color',
|
|
144
|
-
'border-bottom-color',
|
|
145
|
-
'border-left-color',
|
|
146
|
-
'border-image',
|
|
147
|
-
'border-image-source',
|
|
148
|
-
'border-image-width',
|
|
149
|
-
'border-image-outset',
|
|
150
|
-
'border-image-repeat',
|
|
151
|
-
'border-image-slice',
|
|
152
|
-
'border-block',
|
|
153
|
-
'border-block-start',
|
|
154
|
-
'border-block-end',
|
|
155
|
-
'border-block-width',
|
|
156
|
-
'border-block-style',
|
|
157
|
-
'border-block-color',
|
|
158
|
-
'border-inline',
|
|
159
|
-
'border-inline-start',
|
|
160
|
-
'border-inline-end',
|
|
161
|
-
'border-inline-width',
|
|
162
|
-
'border-inline-style',
|
|
163
|
-
'border-inline-color',
|
|
164
|
-
],
|
|
165
|
-
boxShadow: ['box-shadow'],
|
|
166
|
-
background: [
|
|
167
|
-
'background',
|
|
168
|
-
'background-attachment',
|
|
169
|
-
'background-clip',
|
|
170
|
-
'background-color',
|
|
171
|
-
'background-image',
|
|
172
|
-
'background-origin',
|
|
173
|
-
'background-position',
|
|
174
|
-
'background-repeat',
|
|
175
|
-
'background-size',
|
|
176
|
-
'background-blend-mode',
|
|
177
|
-
'object-fit',
|
|
178
|
-
'object-position',
|
|
179
|
-
'image-orientation',
|
|
180
|
-
'image-rendering',
|
|
181
|
-
],
|
|
182
|
-
cursor: ['cursor', 'pointer-events', 'touch-action'],
|
|
183
|
-
padding: [
|
|
184
|
-
'padding',
|
|
185
|
-
'padding-top',
|
|
186
|
-
'padding-right',
|
|
187
|
-
'padding-bottom',
|
|
188
|
-
'padding-left',
|
|
189
|
-
'padding-block',
|
|
190
|
-
'padding-block-start',
|
|
191
|
-
'padding-block-end',
|
|
192
|
-
'padding-inline',
|
|
193
|
-
'padding-inline-start',
|
|
194
|
-
'padding-inline-end',
|
|
195
|
-
],
|
|
196
|
-
dimensions: [
|
|
197
|
-
'width',
|
|
198
|
-
'min-width',
|
|
199
|
-
'max-width',
|
|
200
|
-
'height',
|
|
201
|
-
'min-height',
|
|
202
|
-
'max-height',
|
|
203
|
-
'block-size',
|
|
204
|
-
'min-block-size',
|
|
205
|
-
'max-block-size',
|
|
206
|
-
'inline-size',
|
|
207
|
-
'min-inline-size',
|
|
208
|
-
'max-inline-size',
|
|
209
|
-
],
|
|
210
|
-
overflow: [
|
|
211
|
-
'overflow',
|
|
212
|
-
'overflow-x',
|
|
213
|
-
'overflow-y',
|
|
214
|
-
'overflow-block',
|
|
215
|
-
'overflow-inline',
|
|
216
|
-
'overflow-clip-margin',
|
|
217
|
-
'overflow-anchor',
|
|
218
|
-
'overflow-wrap',
|
|
219
|
-
'overscroll-behavior',
|
|
220
|
-
'overscroll-behavior-x',
|
|
221
|
-
'overscroll-behavior-y',
|
|
222
|
-
'resize',
|
|
223
|
-
'scrollbar-width',
|
|
224
|
-
'scrollbar-color',
|
|
225
|
-
'scrollbar-gutter',
|
|
226
|
-
'scroll-behavior',
|
|
227
|
-
'scroll-margin',
|
|
228
|
-
'scroll-padding',
|
|
229
|
-
'scroll-snap-align',
|
|
230
|
-
'scroll-snap-stop',
|
|
231
|
-
'scroll-snap-type',
|
|
232
|
-
],
|
|
233
|
-
listStyle: ['list-style', 'list-style-type', 'list-style-position', 'list-style-image', 'caption-side'],
|
|
234
|
-
tables: ['table-layout', 'border-collapse', 'border-spacing', 'empty-cells'],
|
|
235
|
-
animation: [
|
|
236
|
-
'animation',
|
|
237
|
-
'animation-name',
|
|
238
|
-
'animation-duration',
|
|
239
|
-
'animation-timing-function',
|
|
240
|
-
'animation-delay',
|
|
241
|
-
'animation-iteration-count',
|
|
242
|
-
'animation-direction',
|
|
243
|
-
'animation-fill-mode',
|
|
244
|
-
'animation-play-state',
|
|
245
|
-
],
|
|
246
|
-
text: [
|
|
247
|
-
'vertical-align',
|
|
248
|
-
'direction',
|
|
249
|
-
'writing-mode',
|
|
250
|
-
'text-orientation',
|
|
251
|
-
'unicode-bidi',
|
|
252
|
-
'tab-size',
|
|
253
|
-
'text-align',
|
|
254
|
-
'text-align-last',
|
|
255
|
-
'text-justify',
|
|
256
|
-
'text-indent',
|
|
257
|
-
'text-transform',
|
|
258
|
-
'text-decoration',
|
|
259
|
-
'text-decoration-color',
|
|
260
|
-
'text-decoration-line',
|
|
261
|
-
'text-decoration-style',
|
|
262
|
-
'text-decoration-thickness',
|
|
263
|
-
'text-decoration-skip-ink',
|
|
264
|
-
'text-underline-position',
|
|
265
|
-
'text-rendering',
|
|
266
|
-
'text-shadow',
|
|
267
|
-
'text-overflow',
|
|
268
|
-
'text-wrap',
|
|
269
|
-
'text-size-adjust',
|
|
270
|
-
'text-combine-upright',
|
|
271
|
-
'hyphens',
|
|
272
|
-
'line-break',
|
|
273
|
-
'ruby-position',
|
|
274
|
-
'caret-color',
|
|
275
|
-
'user-select',
|
|
276
|
-
],
|
|
277
|
-
textSpacing: [
|
|
278
|
-
'line-height',
|
|
279
|
-
'word-spacing',
|
|
280
|
-
'letter-spacing',
|
|
281
|
-
'white-space',
|
|
282
|
-
'word-break',
|
|
283
|
-
'word-wrap',
|
|
284
|
-
'orphans',
|
|
285
|
-
'widows',
|
|
286
|
-
'color',
|
|
287
|
-
],
|
|
288
|
-
font: [
|
|
289
|
-
'font',
|
|
290
|
-
'font-family',
|
|
291
|
-
'font-size',
|
|
292
|
-
'font-size-adjust',
|
|
293
|
-
'font-stretch',
|
|
294
|
-
'font-weight',
|
|
295
|
-
'font-smoothing',
|
|
296
|
-
'osx-font-smoothing',
|
|
297
|
-
'font-variant',
|
|
298
|
-
'font-style',
|
|
299
|
-
'font-feature-settings',
|
|
300
|
-
'font-kerning',
|
|
301
|
-
'font-optical-sizing',
|
|
302
|
-
],
|
|
303
|
-
content: ['content', 'quotes'],
|
|
304
|
-
counters: ['counter-reset', 'counter-increment', 'counter-set'],
|
|
305
|
-
breaks: ['page-break-before', 'page-break-after', 'page-break-inside', 'break-before', 'break-after', 'break-inside'],
|
|
306
|
-
};
|
|
307
|
-
/**
|
|
308
|
-
* Export all available groups for use in custom groups rule
|
|
309
|
-
*/
|
|
310
|
-
exports.availableGroups = Object.keys(exports.concentricGroups);
|
|
@@ -1,7 +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
|
-
const rule_definition_js_1 = __importDefault(require("./rule-definition.js"));
|
|
7
|
-
exports.default = rule_definition_js_1.default;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Rule } from 'eslint';
|
|
2
|
-
import type { CSSPropertyInfo } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Enforces concentric ordering of CSS properties.
|
|
5
|
-
*
|
|
6
|
-
* This function checks the order of CSS properties to ensure they follow a concentric order
|
|
7
|
-
* based on their priority and position within their group. It performs the following steps:
|
|
8
|
-
* 1. Validates if there are enough properties to compare.
|
|
9
|
-
* 2. Creates pairs of consecutive properties for comparison.
|
|
10
|
-
* 3. Identifies the first pair that violates the concentric order.
|
|
11
|
-
* 4. If a violation is detected, reports the issue and suggests fixes using ESLint.
|
|
12
|
-
*
|
|
13
|
-
* @param ruleContext - The ESLint rule context used for reporting and fixing.
|
|
14
|
-
* @param cssPropertyInfoList - An array of CSS property information objects to be checked.
|
|
15
|
-
*/
|
|
16
|
-
export declare const enforceConcentricCSSOrder: (ruleContext: Rule.RuleContext, cssPropertyInfoList: CSSPropertyInfo[]) => void;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enforceConcentricCSSOrder = void 0;
|
|
4
|
-
const css_order_fixer_js_1 = require("../shared-utils/css-order-fixer.js");
|
|
5
|
-
/**
|
|
6
|
-
* Reports a violation of the concentric CSS ordering rule and generates fixes.
|
|
7
|
-
*
|
|
8
|
-
* @param ruleContext The ESLint rule context used for reporting and fixing.
|
|
9
|
-
* @param currentProperty The current property in the order.
|
|
10
|
-
* @param nextProperty The next property that is out of order.
|
|
11
|
-
* @param cssPropertyInfoList The full list of CSS properties to be reordered.
|
|
12
|
-
*/
|
|
13
|
-
const reportOrderingIssue = (ruleContext, currentProperty, nextProperty, cssPropertyInfoList) => {
|
|
14
|
-
ruleContext.report({
|
|
15
|
-
node: nextProperty.node,
|
|
16
|
-
messageId: 'incorrectOrder',
|
|
17
|
-
data: {
|
|
18
|
-
next: nextProperty.name,
|
|
19
|
-
current: currentProperty.name,
|
|
20
|
-
},
|
|
21
|
-
fix: (fixer) => (0, css_order_fixer_js_1.generateFixesForCSSOrder)(fixer, ruleContext, cssPropertyInfoList, compareProperties, (propertyInfo) => propertyInfo.node),
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Compares two CSS properties based on their priority and position within their group.
|
|
26
|
-
*
|
|
27
|
-
* @param firstProperty The first property to compare.
|
|
28
|
-
* @param secondProperty The second property to compare.
|
|
29
|
-
* @returns A number indicating the relative order of the properties (-1, 0, or 1).
|
|
30
|
-
*/
|
|
31
|
-
const compareProperties = (firstProperty, secondProperty) => {
|
|
32
|
-
if (firstProperty.priority !== secondProperty.priority) {
|
|
33
|
-
return firstProperty.priority - secondProperty.priority;
|
|
34
|
-
}
|
|
35
|
-
return firstProperty.positionInGroup - secondProperty.positionInGroup;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Enforces concentric ordering of CSS properties.
|
|
39
|
-
*
|
|
40
|
-
* This function checks the order of CSS properties to ensure they follow a concentric order
|
|
41
|
-
* based on their priority and position within their group. It performs the following steps:
|
|
42
|
-
* 1. Validates if there are enough properties to compare.
|
|
43
|
-
* 2. Creates pairs of consecutive properties for comparison.
|
|
44
|
-
* 3. Identifies the first pair that violates the concentric order.
|
|
45
|
-
* 4. If a violation is detected, reports the issue and suggests fixes using ESLint.
|
|
46
|
-
*
|
|
47
|
-
* @param ruleContext - The ESLint rule context used for reporting and fixing.
|
|
48
|
-
* @param cssPropertyInfoList - An array of CSS property information objects to be checked.
|
|
49
|
-
*/
|
|
50
|
-
const enforceConcentricCSSOrder = (ruleContext, cssPropertyInfoList) => {
|
|
51
|
-
if (cssPropertyInfoList.length <= 1) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
// Create pairs of consecutive properties
|
|
55
|
-
const propertyPairs = cssPropertyInfoList.slice(0, -1).map((currentProperty, index) => ({
|
|
56
|
-
currentProperty,
|
|
57
|
-
nextProperty: cssPropertyInfoList[index + 1],
|
|
58
|
-
}));
|
|
59
|
-
const violatingPair = propertyPairs.find(({ currentProperty, nextProperty }) => compareProperties(currentProperty, nextProperty) > 0);
|
|
60
|
-
if (violatingPair) {
|
|
61
|
-
reportOrderingIssue(ruleContext, violatingPair.currentProperty, violatingPair.nextProperty, cssPropertyInfoList);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
exports.enforceConcentricCSSOrder = enforceConcentricCSSOrder;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Rule } from 'eslint';
|
|
2
|
-
import { TSESTree } from '@typescript-eslint/utils';
|
|
3
|
-
/**
|
|
4
|
-
* Enforces concentric ordering of CSS properties within a recipe function call.
|
|
5
|
-
*
|
|
6
|
-
* @param ruleContext The ESLint rule context for reporting and fixing issues.
|
|
7
|
-
* @param callExpression The CallExpression node representing the recipe function call.
|
|
8
|
-
*
|
|
9
|
-
* This function does the following:
|
|
10
|
-
* 1. Checks if the first argument of the recipe function is an ObjectExpression.
|
|
11
|
-
* 2. If valid, processes the recipe object's properties.
|
|
12
|
-
* 3. For each relevant property (e.g., 'base', 'variants'), it applies concentric ordering to the CSS properties.
|
|
13
|
-
*/
|
|
14
|
-
export declare const enforceConcentricCSSOrderInRecipe: (ruleContext: Rule.RuleContext, callExpression: TSESTree.CallExpression) => void;
|