stylelint-plugin-logical-css 1.2.0 → 1.2.2
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
CHANGED
|
@@ -95,7 +95,9 @@ physical property or value is found, it will be flagged.
|
|
|
95
95
|
max-width: 90ch; /* Will flag the use of "width" */
|
|
96
96
|
text-align: left; /* Will flag the use of "left" */
|
|
97
97
|
opacity: 1;
|
|
98
|
-
transition:
|
|
98
|
+
transition:
|
|
99
|
+
opacity 1s ease,
|
|
100
|
+
max-width 1s ease; /* Will flag the use of 'max-width' */
|
|
99
101
|
}
|
|
100
102
|
```
|
|
101
103
|
|
|
@@ -196,8 +198,6 @@ physical property or value is found, it will be flagged.
|
|
|
196
198
|
| ---------------------------------------------- | ----------------------------------- |
|
|
197
199
|
| `(-webkit-)box-orient: vertical` | `(-webkit-)box-orient: block-axis` |
|
|
198
200
|
| `(-webkit-)box-orient: horizontal` | `(-webkit-)box-orient: inline-axis` |
|
|
199
|
-
| `caption-side: top` | `caption-side: block-start` |
|
|
200
|
-
| `caption-side: bottom` | `caption-side: block-end` |
|
|
201
201
|
| `caption-side: right` | `caption-side: inline-end` |
|
|
202
202
|
| `caption-side: left` | `caption-side: inline-start` |
|
|
203
203
|
| `overflow-y` | `overflow-block` |
|
|
@@ -251,7 +251,7 @@ directions. Instead, this rule will enforce the logical equivalents, `vi` and
|
|
|
251
251
|
```json
|
|
252
252
|
{
|
|
253
253
|
"rules": {
|
|
254
|
-
"plugin/use-logical-
|
|
254
|
+
"plugin/use-logical-units": [
|
|
255
255
|
true,
|
|
256
256
|
{
|
|
257
257
|
"severity": "warning",
|
|
@@ -272,7 +272,11 @@ body {
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
.container {
|
|
275
|
-
inline-size: clamp(
|
|
275
|
+
inline-size: clamp(
|
|
276
|
+
10vw,
|
|
277
|
+
100%,
|
|
278
|
+
50vw
|
|
279
|
+
); /* Will flag the physical use of viewport "width" */
|
|
276
280
|
}
|
|
277
281
|
```
|
|
278
282
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stylelint-plugin-logical-css",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "A Stylelint plugin to enforce the use of logical CSS properties, values and units.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"!**/**/*.test.js"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"prepare": "husky install",
|
|
14
13
|
"jest": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest --runInBand",
|
|
15
14
|
"test": "npm run jest",
|
|
16
15
|
"test:watch": "npm run jest -- --watch"
|
|
@@ -36,18 +35,15 @@
|
|
|
36
35
|
"lint",
|
|
37
36
|
"linter",
|
|
38
37
|
"stylelint",
|
|
39
|
-
"stylelint
|
|
38
|
+
"stylelint plugin",
|
|
40
39
|
"logical css"
|
|
41
40
|
],
|
|
42
41
|
"peerDependencies": {
|
|
43
42
|
"stylelint": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
|
46
|
-
"@commitlint/cli": "^18.4.3",
|
|
47
|
-
"@commitlint/config-conventional": "^18.4.3",
|
|
48
45
|
"cross-env": "^7.0.3",
|
|
49
46
|
"eslint": "^8.35.0",
|
|
50
|
-
"husky": "^8.0.3",
|
|
51
47
|
"jest": "^29.4.3",
|
|
52
48
|
"jest-cli": "^29.4.3",
|
|
53
49
|
"jest-light-runner": "^0.6.0",
|
|
@@ -56,11 +52,5 @@
|
|
|
56
52
|
"prettier": "^3.0.3",
|
|
57
53
|
"prettier-eslint": "^16.1.2",
|
|
58
54
|
"stylelint": "^16.1.0"
|
|
59
|
-
},
|
|
60
|
-
"lint-staged": {
|
|
61
|
-
"**/*.js|md|json": [
|
|
62
|
-
"eslint",
|
|
63
|
-
"prettier --write"
|
|
64
|
-
]
|
|
65
55
|
}
|
|
66
|
-
}
|
|
56
|
+
}
|
|
@@ -35,6 +35,10 @@ const ruleFunction = (_, options, context) => {
|
|
|
35
35
|
].includes(rootProp);
|
|
36
36
|
if (!isValidProp) return;
|
|
37
37
|
|
|
38
|
+
const isCaptionSideProperty = rootProp === 'caption-side';
|
|
39
|
+
const isBlockAxisCaptionSideValue =
|
|
40
|
+
isCaptionSideProperty && ['top', 'bottom'].includes(decl.value);
|
|
41
|
+
|
|
38
42
|
const isTransitionProperty = rootProp === 'transition';
|
|
39
43
|
const physicalTransitionProperties =
|
|
40
44
|
isTransitionProperty &&
|
|
@@ -49,9 +53,10 @@ const ruleFunction = (_, options, context) => {
|
|
|
49
53
|
const valueIsPhysical = isPhysicalValue(decl.value);
|
|
50
54
|
|
|
51
55
|
if (
|
|
52
|
-
!propIsPhysical &&
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
(!propIsPhysical &&
|
|
57
|
+
!valueIsPhysical &&
|
|
58
|
+
!physicalTransitionProperties.length) ||
|
|
59
|
+
isBlockAxisCaptionSideValue
|
|
55
60
|
) {
|
|
56
61
|
return;
|
|
57
62
|
}
|
|
@@ -64,6 +69,7 @@ const ruleFunction = (_, options, context) => {
|
|
|
64
69
|
physicalPropertiesMap[rootProp],
|
|
65
70
|
);
|
|
66
71
|
}
|
|
72
|
+
|
|
67
73
|
if (valueIsPhysical) {
|
|
68
74
|
message = ruleMessages.unexpectedValue(
|
|
69
75
|
decl.prop,
|
|
@@ -71,6 +77,7 @@ const ruleFunction = (_, options, context) => {
|
|
|
71
77
|
physicalValuesMap[rootProp][decl.value],
|
|
72
78
|
);
|
|
73
79
|
}
|
|
80
|
+
|
|
74
81
|
if (physicalTransitionProperties.length) {
|
|
75
82
|
const propertyToFlag = physicalTransitionProperties[0].trim();
|
|
76
83
|
message = ruleMessages.unexpectedTransitionValue(
|
package/src/utils/logical.js
CHANGED
|
@@ -44,7 +44,6 @@ export const logicalProperties = Object.freeze({
|
|
|
44
44
|
containIntrinsicBlockSize: 'contain-intrinsic-block-size',
|
|
45
45
|
containIntrinsicInlineSize: 'contain-intrinsic-inline-size',
|
|
46
46
|
inlineSize: 'inline-size',
|
|
47
|
-
inset: 'inset',
|
|
48
47
|
insetBlock: 'inset-block',
|
|
49
48
|
insetBlockEnd: 'inset-block-end',
|
|
50
49
|
insetBlockStart: 'inset-block-start',
|
|
@@ -11,10 +11,8 @@ export const physicalValuesMap = Object.freeze({
|
|
|
11
11
|
[physicalAxis.vertical]: `${logicalAxis.block}-axis`,
|
|
12
12
|
},
|
|
13
13
|
[physicalProperties.captionSide]: {
|
|
14
|
-
[physicalValues.bottom]: logicalValues.blockEnd,
|
|
15
14
|
[physicalValues.left]: logicalValues.inlineStart,
|
|
16
15
|
[physicalValues.right]: logicalValues.inlineEnd,
|
|
17
|
-
[physicalValues.top]: logicalValues.blockStart,
|
|
18
16
|
},
|
|
19
17
|
[physicalProperties.clear]: {
|
|
20
18
|
[physicalValues.left]: logicalValues.inlineStart,
|