@atlaskit/eslint-plugin-design-system 8.6.0 → 8.7.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/CHANGELOG.md +6 -0
- package/README.md +1 -0
- package/constellation/index/usage.mdx +55 -0
- package/dist/cjs/presets/all.codegen.js +2 -1
- package/dist/cjs/rules/index.codegen.js +3 -1
- package/dist/cjs/rules/no-physical-properties/index.js +49 -0
- package/dist/cjs/rules/no-physical-properties/logical-physical-map.js +114 -0
- package/dist/es2019/presets/all.codegen.js +2 -1
- package/dist/es2019/rules/index.codegen.js +3 -1
- package/dist/es2019/rules/no-physical-properties/index.js +44 -0
- package/dist/es2019/rules/no-physical-properties/logical-physical-map.js +106 -0
- package/dist/esm/presets/all.codegen.js +2 -1
- package/dist/esm/rules/index.codegen.js +3 -1
- package/dist/esm/rules/no-physical-properties/index.js +42 -0
- package/dist/esm/rules/no-physical-properties/logical-physical-map.js +106 -0
- package/dist/types/index.codegen.d.ts +1 -0
- package/dist/types/presets/all.codegen.d.ts +2 -1
- package/dist/types/rules/index.codegen.d.ts +1 -0
- package/dist/types/rules/no-physical-properties/index.d.ts +3 -0
- package/dist/types/rules/no-physical-properties/logical-physical-map.d.ts +106 -0
- package/dist/types-ts4.5/index.codegen.d.ts +1 -0
- package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -1
- package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
- package/dist/types-ts4.5/rules/no-physical-properties/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/no-physical-properties/logical-physical-map.d.ts +106 -0
- package/package.json +1 -1
- package/report.api.md +2 -0
- package/tmp/api-report-tmp.d.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 8.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`859ef96da96`](https://bitbucket.org/atlassian/atlassian-frontend/commits/859ef96da96) - Adds additional rule encouraging the use of CSS logical properties. This rule comes with a fix for code that uses object syntax (via css, styled or xcss) for styles.
|
|
8
|
+
|
|
3
9
|
## 8.6.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -59,6 +59,7 @@ module.exports = {
|
|
|
59
59
|
| <a href="./src/rules/no-deprecated-imports/README.md">no-deprecated-imports</a> | Disallow importing deprecated modules. | Yes | | |
|
|
60
60
|
| <a href="./src/rules/no-margin/README.md">no-margin</a> | Disallow using the margin CSS property. | | | |
|
|
61
61
|
| <a href="./src/rules/no-nested-styles/README.md">no-nested-styles</a> | Disallows use of nested styles in `css` functions. | Yes | | |
|
|
62
|
+
| <a href="./src/rules/no-physical-properties/README.md">no-physical-properties</a> | Disallow physical properties and values in `css` function calls. | | Yes | |
|
|
62
63
|
| <a href="./src/rules/no-unsafe-design-token-usage/README.md">no-unsafe-design-token-usage</a> | Enforces design token usage is statically and locally analyzable. | Yes | Yes | |
|
|
63
64
|
| <a href="./src/rules/prefer-primitives/README.md">prefer-primitives</a> | Increase awareness of primitive components via code hints. Strictly used for education purposes and discoverability. To enforce usage please refer to the `use-primitives` rule. | | | |
|
|
64
65
|
| <a href="./src/rules/use-primitives/README.md">use-primitives</a> | Encourage the usage of primitives components. | | Yes | Yes |
|
|
@@ -23,6 +23,7 @@ This plugin contains rules that should be used when working with the [Atlassian
|
|
|
23
23
|
| <a href="#no-deprecated-imports">no-deprecated-imports</a> | Disallow importing deprecated modules. | Yes | | |
|
|
24
24
|
| <a href="#no-margin">no-margin</a> | Disallow using the margin CSS property. | | | |
|
|
25
25
|
| <a href="#no-nested-styles">no-nested-styles</a> | Disallows use of nested styles in `css` functions. | Yes | | |
|
|
26
|
+
| <a href="#no-physical-properties">no-physical-properties</a> | Disallow physical properties and values in `css` function calls. | | Yes | |
|
|
26
27
|
| <a href="#no-unsafe-design-token-usage">no-unsafe-design-token-usage</a> | Enforces design token usage is statically and locally analyzable. | Yes | Yes | |
|
|
27
28
|
| <a href="#prefer-primitives">prefer-primitives</a> | Increase awareness of primitive components via code hints. Strictly used for education purposes and discoverability. To enforce usage please refer to the `use-primitives` rule. | | | |
|
|
28
29
|
| <a href="#use-primitives">use-primitives</a> | Encourage the usage of primitives components. | | Yes | Yes |
|
|
@@ -501,6 +502,60 @@ css({
|
|
|
501
502
|
});
|
|
502
503
|
```
|
|
503
504
|
|
|
505
|
+
## no-physical-properties
|
|
506
|
+
|
|
507
|
+
Disallows using physical properties. Physical properties
|
|
508
|
+
prevent correct support for different reading modes and languages and
|
|
509
|
+
should be avoided. Rule will autofix applicable physical properties
|
|
510
|
+
to instead use [logical properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_logical_properties_and_values/Basic_concepts_of_logical_properties_and_values).
|
|
511
|
+
|
|
512
|
+
<h3>Examples</h3>
|
|
513
|
+
|
|
514
|
+
This rule checks for physical property usage inside of `css` function calls.
|
|
515
|
+
|
|
516
|
+
#### Incorrect
|
|
517
|
+
|
|
518
|
+
```js
|
|
519
|
+
css({
|
|
520
|
+
left: 0,
|
|
521
|
+
right: 0,
|
|
522
|
+
top: 0,
|
|
523
|
+
bottom: 0,
|
|
524
|
+
});
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
```js
|
|
528
|
+
css({
|
|
529
|
+
marginLeft: 0,
|
|
530
|
+
});
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
```js
|
|
534
|
+
css({
|
|
535
|
+
textAlign: 'left',
|
|
536
|
+
});
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
#### Correct
|
|
540
|
+
|
|
541
|
+
```js
|
|
542
|
+
css({
|
|
543
|
+
inset: 0,
|
|
544
|
+
});
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
```js
|
|
548
|
+
css({
|
|
549
|
+
marginInlineStart: 0,
|
|
550
|
+
});
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
```js
|
|
554
|
+
css({
|
|
555
|
+
textAlign: 'start',
|
|
556
|
+
});
|
|
557
|
+
```
|
|
558
|
+
|
|
504
559
|
## no-unsafe-design-token-usage
|
|
505
560
|
|
|
506
561
|
Using design tokens in an unsafe way risks the health of the system and will effect how fast your codebase can migrate between versions.
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
9
|
-
* @codegen <<SignedSource::
|
|
9
|
+
* @codegen <<SignedSource::0dad73a6ffc9bd6b08475ff31c542817>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
var _default = {
|
|
@@ -22,6 +22,7 @@ var _default = {
|
|
|
22
22
|
'@atlaskit/design-system/no-deprecated-imports': 'error',
|
|
23
23
|
'@atlaskit/design-system/no-margin': 'warn',
|
|
24
24
|
'@atlaskit/design-system/no-nested-styles': 'error',
|
|
25
|
+
'@atlaskit/design-system/no-physical-properties': 'error',
|
|
25
26
|
'@atlaskit/design-system/no-unsafe-design-token-usage': 'error',
|
|
26
27
|
'@atlaskit/design-system/prefer-primitives': 'warn',
|
|
27
28
|
'@atlaskit/design-system/use-primitives': 'warn',
|
|
@@ -15,13 +15,14 @@ var _noDeprecatedDesignTokenUsage = _interopRequireDefault(require("./no-depreca
|
|
|
15
15
|
var _noDeprecatedImports = _interopRequireDefault(require("./no-deprecated-imports"));
|
|
16
16
|
var _noMargin = _interopRequireDefault(require("./no-margin"));
|
|
17
17
|
var _noNestedStyles = _interopRequireDefault(require("./no-nested-styles"));
|
|
18
|
+
var _noPhysicalProperties = _interopRequireDefault(require("./no-physical-properties"));
|
|
18
19
|
var _noUnsafeDesignTokenUsage = _interopRequireDefault(require("./no-unsafe-design-token-usage"));
|
|
19
20
|
var _preferPrimitives = _interopRequireDefault(require("./prefer-primitives"));
|
|
20
21
|
var _usePrimitives = _interopRequireDefault(require("./use-primitives"));
|
|
21
22
|
var _useVisuallyHidden = _interopRequireDefault(require("./use-visually-hidden"));
|
|
22
23
|
/**
|
|
23
24
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
24
|
-
* @codegen <<SignedSource::
|
|
25
|
+
* @codegen <<SignedSource::6f157f425fabf1a47ca99e3e0b99045b>>
|
|
25
26
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
26
27
|
*/
|
|
27
28
|
var _default = {
|
|
@@ -35,6 +36,7 @@ var _default = {
|
|
|
35
36
|
'no-deprecated-imports': _noDeprecatedImports.default,
|
|
36
37
|
'no-margin': _noMargin.default,
|
|
37
38
|
'no-nested-styles': _noNestedStyles.default,
|
|
39
|
+
'no-physical-properties': _noPhysicalProperties.default,
|
|
38
40
|
'no-unsafe-design-token-usage': _noUnsafeDesignTokenUsage.default,
|
|
39
41
|
'prefer-primitives': _preferPrimitives.default,
|
|
40
42
|
'use-primitives': _usePrimitives.default,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
8
|
+
var _createRule = require("../utils/create-rule");
|
|
9
|
+
var _logicalPhysicalMap = require("./logical-physical-map");
|
|
10
|
+
var rule = (0, _createRule.createLintRule)({
|
|
11
|
+
meta: {
|
|
12
|
+
name: 'no-physical-properties',
|
|
13
|
+
fixable: 'code',
|
|
14
|
+
docs: {
|
|
15
|
+
description: 'Disallow physical properties and values in `css` function calls.',
|
|
16
|
+
recommended: false,
|
|
17
|
+
severity: 'error'
|
|
18
|
+
},
|
|
19
|
+
messages: {
|
|
20
|
+
noPhysicalProperties: 'Physical properties are not allowed in `css` functions as they do not support different reading modes. Use a logical property instead.',
|
|
21
|
+
noPhysicalValues: 'Physical values are not allowed in `css` functions.'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
create: function create(context) {
|
|
25
|
+
return {
|
|
26
|
+
'CallExpression[callee.name=css] > ObjectExpression Property,CallExpression[callee.name=xcss] > ObjectExpression Property': function CallExpressionCalleeNameCssObjectExpressionPropertyCallExpressionCalleeNameXcssObjectExpressionProperty(node) {
|
|
27
|
+
if (!(0, _eslintCodemodUtils.isNodeOfType)(node, 'Property')) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (!(0, _eslintCodemodUtils.isNodeOfType)(node.key, 'Identifier')) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
var key = node.key;
|
|
34
|
+
if (key.name in _logicalPhysicalMap.physicalLogicalMap) {
|
|
35
|
+
context.report({
|
|
36
|
+
node: key,
|
|
37
|
+
messageId: 'noPhysicalProperties',
|
|
38
|
+
fix: function fix(fixer) {
|
|
39
|
+
var logicalProperty = _logicalPhysicalMap.physicalLogicalMap[key.name];
|
|
40
|
+
return fixer.replaceText(key, logicalProperty);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
var _default = rule;
|
|
49
|
+
exports.default = _default;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.physicalLogicalMap = exports.logicalPhysicalMap = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Logical property to physical property map
|
|
9
|
+
* @example
|
|
10
|
+
* ```
|
|
11
|
+
* border-block-end border-bottom
|
|
12
|
+
* border-block-end-color border-bottom-color
|
|
13
|
+
* border-block-end-style border-bottom-style
|
|
14
|
+
* border-block-end-width border-bottom-width
|
|
15
|
+
* border-block-start border-top
|
|
16
|
+
* border-block-start-color border-top-color
|
|
17
|
+
* border-block-start-style border-top-style
|
|
18
|
+
* border-block-start-width border-top-width
|
|
19
|
+
* border-inline-end border-right
|
|
20
|
+
* border-inline-end-color border-right-color
|
|
21
|
+
* border-inline-end-style border-right-style
|
|
22
|
+
* border-inline-end-width border-right-width
|
|
23
|
+
* border-inline-start border-left
|
|
24
|
+
* border-inline-start-color border-left-color
|
|
25
|
+
* border-inline-start-style border-left-style
|
|
26
|
+
* border-inline-start-width border-left-width
|
|
27
|
+
* border-start-start-radius border-top-left-radius
|
|
28
|
+
* border-end-start-radius border-bottom-left-radius
|
|
29
|
+
* border-start-end-radius border-top-right-radius
|
|
30
|
+
* border-end-end-radius border-bottom-right-radius
|
|
31
|
+
* margin-block-end margin-bottom
|
|
32
|
+
* margin-block-start margin-top
|
|
33
|
+
* margin-inline-end margin-right
|
|
34
|
+
* margin-inline-start margin-left
|
|
35
|
+
* padding-block-end padding-bottom
|
|
36
|
+
* padding-block-start padding-top
|
|
37
|
+
* padding-inline-end padding-right
|
|
38
|
+
* padding-inline-start padding-left
|
|
39
|
+
* inset-inline-start left
|
|
40
|
+
* inset-inline-end right
|
|
41
|
+
* inset-block-start top
|
|
42
|
+
* inset-block-end bottom
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
var logicalPhysicalMap = {
|
|
46
|
+
borderBlockEnd: 'borderBottom',
|
|
47
|
+
borderBlockEndColor: 'borderBottomColor',
|
|
48
|
+
borderBlockEndStyle: 'borderBottomStyle',
|
|
49
|
+
borderBlockEndWidth: 'borderBottomWidth',
|
|
50
|
+
borderBlockStart: 'borderTop',
|
|
51
|
+
borderBlockStartColor: 'borderTopColor',
|
|
52
|
+
borderBlockStartStyle: 'borderTopStyle',
|
|
53
|
+
borderBlockStartWidth: 'borderTopWidth',
|
|
54
|
+
borderInlineEnd: 'borderRight',
|
|
55
|
+
borderInlineEndColor: 'borderRightColor',
|
|
56
|
+
borderInlineEndStyle: 'borderRightStyle',
|
|
57
|
+
borderInlineEndWidth: 'borderRightWidth',
|
|
58
|
+
borderInlineStart: 'borderLeft',
|
|
59
|
+
borderInlineStartColor: 'borderLeftColor',
|
|
60
|
+
borderInlineStartStyle: 'borderLeftStyle',
|
|
61
|
+
borderInlineStartWidth: 'borderLeftWidth',
|
|
62
|
+
borderStartStartRadius: 'borderTopLeftRadius',
|
|
63
|
+
borderEndStartRadius: 'borderBottomLeftRadius',
|
|
64
|
+
borderStartEndRadius: 'borderTopRightRadius',
|
|
65
|
+
borderEndEndRadius: 'borderBottomRightRadius',
|
|
66
|
+
marginBlockEnd: 'marginBottom',
|
|
67
|
+
marginBlockStart: 'marginTop',
|
|
68
|
+
marginInlineEnd: 'marginRight',
|
|
69
|
+
marginInlineStart: 'marginLeft',
|
|
70
|
+
paddingBlockEnd: 'paddingBottom',
|
|
71
|
+
paddingBlockStart: 'paddingTop',
|
|
72
|
+
paddingInlineEnd: 'paddingRight',
|
|
73
|
+
paddingInlineStart: 'paddingLeft',
|
|
74
|
+
insetInlineStart: 'left',
|
|
75
|
+
insetInlineEnd: 'right',
|
|
76
|
+
insetBlockStart: 'top',
|
|
77
|
+
insetBlockEnd: 'bottom'
|
|
78
|
+
};
|
|
79
|
+
exports.logicalPhysicalMap = logicalPhysicalMap;
|
|
80
|
+
var physicalLogicalMap = {
|
|
81
|
+
borderBottom: 'borderBlockEnd',
|
|
82
|
+
borderBottomColor: 'borderBlockEndColor',
|
|
83
|
+
borderBottomStyle: 'borderBlockEndStyle',
|
|
84
|
+
borderBottomWidth: 'borderBlockEndWidth',
|
|
85
|
+
borderTop: 'borderBlockStart',
|
|
86
|
+
borderTopColor: 'borderBlockStartColor',
|
|
87
|
+
borderTopStyle: 'borderBlockStartStyle',
|
|
88
|
+
borderTopWidth: 'borderBlockStartWidth',
|
|
89
|
+
borderRight: 'borderInlineEnd',
|
|
90
|
+
borderRightColor: 'borderInlineEndColor',
|
|
91
|
+
borderRightStyle: 'borderInlineEndStyle',
|
|
92
|
+
borderRightWidth: 'borderInlineEndWidth',
|
|
93
|
+
borderLeft: 'borderInlineStart',
|
|
94
|
+
borderLeftColor: 'borderInlineStartColor',
|
|
95
|
+
borderLeftStyle: 'borderInlineStartStyle',
|
|
96
|
+
borderLeftWidth: 'borderInlineStartWidth',
|
|
97
|
+
borderTopLeftRadius: 'borderStartStartRadius',
|
|
98
|
+
borderBottomLeftRadius: 'borderEndStartRadius',
|
|
99
|
+
borderTopRightRadius: 'borderStartEndRadius',
|
|
100
|
+
borderBottomRightRadius: 'borderEndEndRadius',
|
|
101
|
+
marginBottom: 'marginBlockEnd',
|
|
102
|
+
marginTop: 'marginBlockStart',
|
|
103
|
+
marginRight: 'marginInlineEnd',
|
|
104
|
+
marginLeft: 'marginInlineStart',
|
|
105
|
+
paddingBottom: 'paddingBlockEnd',
|
|
106
|
+
paddingTop: 'paddingBlockStart',
|
|
107
|
+
paddingRight: 'paddingInlineEnd',
|
|
108
|
+
paddingLeft: 'paddingInlineStart',
|
|
109
|
+
left: 'insetInlineStart',
|
|
110
|
+
right: 'insetInlineEnd',
|
|
111
|
+
top: 'insetBlockStart',
|
|
112
|
+
bottom: 'insetBlockEnd'
|
|
113
|
+
};
|
|
114
|
+
exports.physicalLogicalMap = physicalLogicalMap;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::0dad73a6ffc9bd6b08475ff31c542817>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
@@ -16,6 +16,7 @@ export default {
|
|
|
16
16
|
'@atlaskit/design-system/no-deprecated-imports': 'error',
|
|
17
17
|
'@atlaskit/design-system/no-margin': 'warn',
|
|
18
18
|
'@atlaskit/design-system/no-nested-styles': 'error',
|
|
19
|
+
'@atlaskit/design-system/no-physical-properties': 'error',
|
|
19
20
|
'@atlaskit/design-system/no-unsafe-design-token-usage': 'error',
|
|
20
21
|
'@atlaskit/design-system/prefer-primitives': 'warn',
|
|
21
22
|
'@atlaskit/design-system/use-primitives': 'warn',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::6f157f425fabf1a47ca99e3e0b99045b>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import consistentCssPropUsage from './consistent-css-prop-usage';
|
|
@@ -13,6 +13,7 @@ import noDeprecatedDesignTokenUsage from './no-deprecated-design-token-usage';
|
|
|
13
13
|
import noDeprecatedImports from './no-deprecated-imports';
|
|
14
14
|
import noMargin from './no-margin';
|
|
15
15
|
import noNestedStyles from './no-nested-styles';
|
|
16
|
+
import noPhysicalProperties from './no-physical-properties';
|
|
16
17
|
import noUnsafeDesignTokenUsage from './no-unsafe-design-token-usage';
|
|
17
18
|
import preferPrimitives from './prefer-primitives';
|
|
18
19
|
import usePrimitives from './use-primitives';
|
|
@@ -28,6 +29,7 @@ export default {
|
|
|
28
29
|
'no-deprecated-imports': noDeprecatedImports,
|
|
29
30
|
'no-margin': noMargin,
|
|
30
31
|
'no-nested-styles': noNestedStyles,
|
|
32
|
+
'no-physical-properties': noPhysicalProperties,
|
|
31
33
|
'no-unsafe-design-token-usage': noUnsafeDesignTokenUsage,
|
|
32
34
|
'prefer-primitives': preferPrimitives,
|
|
33
35
|
'use-primitives': usePrimitives,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
+
import { createLintRule } from '../utils/create-rule';
|
|
3
|
+
import { physicalLogicalMap } from './logical-physical-map';
|
|
4
|
+
const rule = createLintRule({
|
|
5
|
+
meta: {
|
|
6
|
+
name: 'no-physical-properties',
|
|
7
|
+
fixable: 'code',
|
|
8
|
+
docs: {
|
|
9
|
+
description: 'Disallow physical properties and values in `css` function calls.',
|
|
10
|
+
recommended: false,
|
|
11
|
+
severity: 'error'
|
|
12
|
+
},
|
|
13
|
+
messages: {
|
|
14
|
+
noPhysicalProperties: 'Physical properties are not allowed in `css` functions as they do not support different reading modes. Use a logical property instead.',
|
|
15
|
+
noPhysicalValues: 'Physical values are not allowed in `css` functions.'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
create(context) {
|
|
19
|
+
return {
|
|
20
|
+
'CallExpression[callee.name=css] > ObjectExpression Property,CallExpression[callee.name=xcss] > ObjectExpression Property': node => {
|
|
21
|
+
if (!isNodeOfType(node, 'Property')) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (!isNodeOfType(node.key, 'Identifier')) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const {
|
|
28
|
+
key
|
|
29
|
+
} = node;
|
|
30
|
+
if (key.name in physicalLogicalMap) {
|
|
31
|
+
context.report({
|
|
32
|
+
node: key,
|
|
33
|
+
messageId: 'noPhysicalProperties',
|
|
34
|
+
fix: fixer => {
|
|
35
|
+
const logicalProperty = physicalLogicalMap[key.name];
|
|
36
|
+
return fixer.replaceText(key, logicalProperty);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
export default rule;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logical property to physical property map
|
|
3
|
+
* @example
|
|
4
|
+
* ```
|
|
5
|
+
* border-block-end border-bottom
|
|
6
|
+
* border-block-end-color border-bottom-color
|
|
7
|
+
* border-block-end-style border-bottom-style
|
|
8
|
+
* border-block-end-width border-bottom-width
|
|
9
|
+
* border-block-start border-top
|
|
10
|
+
* border-block-start-color border-top-color
|
|
11
|
+
* border-block-start-style border-top-style
|
|
12
|
+
* border-block-start-width border-top-width
|
|
13
|
+
* border-inline-end border-right
|
|
14
|
+
* border-inline-end-color border-right-color
|
|
15
|
+
* border-inline-end-style border-right-style
|
|
16
|
+
* border-inline-end-width border-right-width
|
|
17
|
+
* border-inline-start border-left
|
|
18
|
+
* border-inline-start-color border-left-color
|
|
19
|
+
* border-inline-start-style border-left-style
|
|
20
|
+
* border-inline-start-width border-left-width
|
|
21
|
+
* border-start-start-radius border-top-left-radius
|
|
22
|
+
* border-end-start-radius border-bottom-left-radius
|
|
23
|
+
* border-start-end-radius border-top-right-radius
|
|
24
|
+
* border-end-end-radius border-bottom-right-radius
|
|
25
|
+
* margin-block-end margin-bottom
|
|
26
|
+
* margin-block-start margin-top
|
|
27
|
+
* margin-inline-end margin-right
|
|
28
|
+
* margin-inline-start margin-left
|
|
29
|
+
* padding-block-end padding-bottom
|
|
30
|
+
* padding-block-start padding-top
|
|
31
|
+
* padding-inline-end padding-right
|
|
32
|
+
* padding-inline-start padding-left
|
|
33
|
+
* inset-inline-start left
|
|
34
|
+
* inset-inline-end right
|
|
35
|
+
* inset-block-start top
|
|
36
|
+
* inset-block-end bottom
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export const logicalPhysicalMap = {
|
|
40
|
+
borderBlockEnd: 'borderBottom',
|
|
41
|
+
borderBlockEndColor: 'borderBottomColor',
|
|
42
|
+
borderBlockEndStyle: 'borderBottomStyle',
|
|
43
|
+
borderBlockEndWidth: 'borderBottomWidth',
|
|
44
|
+
borderBlockStart: 'borderTop',
|
|
45
|
+
borderBlockStartColor: 'borderTopColor',
|
|
46
|
+
borderBlockStartStyle: 'borderTopStyle',
|
|
47
|
+
borderBlockStartWidth: 'borderTopWidth',
|
|
48
|
+
borderInlineEnd: 'borderRight',
|
|
49
|
+
borderInlineEndColor: 'borderRightColor',
|
|
50
|
+
borderInlineEndStyle: 'borderRightStyle',
|
|
51
|
+
borderInlineEndWidth: 'borderRightWidth',
|
|
52
|
+
borderInlineStart: 'borderLeft',
|
|
53
|
+
borderInlineStartColor: 'borderLeftColor',
|
|
54
|
+
borderInlineStartStyle: 'borderLeftStyle',
|
|
55
|
+
borderInlineStartWidth: 'borderLeftWidth',
|
|
56
|
+
borderStartStartRadius: 'borderTopLeftRadius',
|
|
57
|
+
borderEndStartRadius: 'borderBottomLeftRadius',
|
|
58
|
+
borderStartEndRadius: 'borderTopRightRadius',
|
|
59
|
+
borderEndEndRadius: 'borderBottomRightRadius',
|
|
60
|
+
marginBlockEnd: 'marginBottom',
|
|
61
|
+
marginBlockStart: 'marginTop',
|
|
62
|
+
marginInlineEnd: 'marginRight',
|
|
63
|
+
marginInlineStart: 'marginLeft',
|
|
64
|
+
paddingBlockEnd: 'paddingBottom',
|
|
65
|
+
paddingBlockStart: 'paddingTop',
|
|
66
|
+
paddingInlineEnd: 'paddingRight',
|
|
67
|
+
paddingInlineStart: 'paddingLeft',
|
|
68
|
+
insetInlineStart: 'left',
|
|
69
|
+
insetInlineEnd: 'right',
|
|
70
|
+
insetBlockStart: 'top',
|
|
71
|
+
insetBlockEnd: 'bottom'
|
|
72
|
+
};
|
|
73
|
+
export const physicalLogicalMap = {
|
|
74
|
+
borderBottom: 'borderBlockEnd',
|
|
75
|
+
borderBottomColor: 'borderBlockEndColor',
|
|
76
|
+
borderBottomStyle: 'borderBlockEndStyle',
|
|
77
|
+
borderBottomWidth: 'borderBlockEndWidth',
|
|
78
|
+
borderTop: 'borderBlockStart',
|
|
79
|
+
borderTopColor: 'borderBlockStartColor',
|
|
80
|
+
borderTopStyle: 'borderBlockStartStyle',
|
|
81
|
+
borderTopWidth: 'borderBlockStartWidth',
|
|
82
|
+
borderRight: 'borderInlineEnd',
|
|
83
|
+
borderRightColor: 'borderInlineEndColor',
|
|
84
|
+
borderRightStyle: 'borderInlineEndStyle',
|
|
85
|
+
borderRightWidth: 'borderInlineEndWidth',
|
|
86
|
+
borderLeft: 'borderInlineStart',
|
|
87
|
+
borderLeftColor: 'borderInlineStartColor',
|
|
88
|
+
borderLeftStyle: 'borderInlineStartStyle',
|
|
89
|
+
borderLeftWidth: 'borderInlineStartWidth',
|
|
90
|
+
borderTopLeftRadius: 'borderStartStartRadius',
|
|
91
|
+
borderBottomLeftRadius: 'borderEndStartRadius',
|
|
92
|
+
borderTopRightRadius: 'borderStartEndRadius',
|
|
93
|
+
borderBottomRightRadius: 'borderEndEndRadius',
|
|
94
|
+
marginBottom: 'marginBlockEnd',
|
|
95
|
+
marginTop: 'marginBlockStart',
|
|
96
|
+
marginRight: 'marginInlineEnd',
|
|
97
|
+
marginLeft: 'marginInlineStart',
|
|
98
|
+
paddingBottom: 'paddingBlockEnd',
|
|
99
|
+
paddingTop: 'paddingBlockStart',
|
|
100
|
+
paddingRight: 'paddingInlineEnd',
|
|
101
|
+
paddingLeft: 'paddingInlineStart',
|
|
102
|
+
left: 'insetInlineStart',
|
|
103
|
+
right: 'insetInlineEnd',
|
|
104
|
+
top: 'insetBlockStart',
|
|
105
|
+
bottom: 'insetBlockEnd'
|
|
106
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::0dad73a6ffc9bd6b08475ff31c542817>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
@@ -16,6 +16,7 @@ export default {
|
|
|
16
16
|
'@atlaskit/design-system/no-deprecated-imports': 'error',
|
|
17
17
|
'@atlaskit/design-system/no-margin': 'warn',
|
|
18
18
|
'@atlaskit/design-system/no-nested-styles': 'error',
|
|
19
|
+
'@atlaskit/design-system/no-physical-properties': 'error',
|
|
19
20
|
'@atlaskit/design-system/no-unsafe-design-token-usage': 'error',
|
|
20
21
|
'@atlaskit/design-system/prefer-primitives': 'warn',
|
|
21
22
|
'@atlaskit/design-system/use-primitives': 'warn',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::6f157f425fabf1a47ca99e3e0b99045b>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import consistentCssPropUsage from './consistent-css-prop-usage';
|
|
@@ -13,6 +13,7 @@ import noDeprecatedDesignTokenUsage from './no-deprecated-design-token-usage';
|
|
|
13
13
|
import noDeprecatedImports from './no-deprecated-imports';
|
|
14
14
|
import noMargin from './no-margin';
|
|
15
15
|
import noNestedStyles from './no-nested-styles';
|
|
16
|
+
import noPhysicalProperties from './no-physical-properties';
|
|
16
17
|
import noUnsafeDesignTokenUsage from './no-unsafe-design-token-usage';
|
|
17
18
|
import preferPrimitives from './prefer-primitives';
|
|
18
19
|
import usePrimitives from './use-primitives';
|
|
@@ -28,6 +29,7 @@ export default {
|
|
|
28
29
|
'no-deprecated-imports': noDeprecatedImports,
|
|
29
30
|
'no-margin': noMargin,
|
|
30
31
|
'no-nested-styles': noNestedStyles,
|
|
32
|
+
'no-physical-properties': noPhysicalProperties,
|
|
31
33
|
'no-unsafe-design-token-usage': noUnsafeDesignTokenUsage,
|
|
32
34
|
'prefer-primitives': preferPrimitives,
|
|
33
35
|
'use-primitives': usePrimitives,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
+
import { createLintRule } from '../utils/create-rule';
|
|
3
|
+
import { physicalLogicalMap } from './logical-physical-map';
|
|
4
|
+
var rule = createLintRule({
|
|
5
|
+
meta: {
|
|
6
|
+
name: 'no-physical-properties',
|
|
7
|
+
fixable: 'code',
|
|
8
|
+
docs: {
|
|
9
|
+
description: 'Disallow physical properties and values in `css` function calls.',
|
|
10
|
+
recommended: false,
|
|
11
|
+
severity: 'error'
|
|
12
|
+
},
|
|
13
|
+
messages: {
|
|
14
|
+
noPhysicalProperties: 'Physical properties are not allowed in `css` functions as they do not support different reading modes. Use a logical property instead.',
|
|
15
|
+
noPhysicalValues: 'Physical values are not allowed in `css` functions.'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
create: function create(context) {
|
|
19
|
+
return {
|
|
20
|
+
'CallExpression[callee.name=css] > ObjectExpression Property,CallExpression[callee.name=xcss] > ObjectExpression Property': function CallExpressionCalleeNameCssObjectExpressionPropertyCallExpressionCalleeNameXcssObjectExpressionProperty(node) {
|
|
21
|
+
if (!isNodeOfType(node, 'Property')) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (!isNodeOfType(node.key, 'Identifier')) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
var key = node.key;
|
|
28
|
+
if (key.name in physicalLogicalMap) {
|
|
29
|
+
context.report({
|
|
30
|
+
node: key,
|
|
31
|
+
messageId: 'noPhysicalProperties',
|
|
32
|
+
fix: function fix(fixer) {
|
|
33
|
+
var logicalProperty = physicalLogicalMap[key.name];
|
|
34
|
+
return fixer.replaceText(key, logicalProperty);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
export default rule;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logical property to physical property map
|
|
3
|
+
* @example
|
|
4
|
+
* ```
|
|
5
|
+
* border-block-end border-bottom
|
|
6
|
+
* border-block-end-color border-bottom-color
|
|
7
|
+
* border-block-end-style border-bottom-style
|
|
8
|
+
* border-block-end-width border-bottom-width
|
|
9
|
+
* border-block-start border-top
|
|
10
|
+
* border-block-start-color border-top-color
|
|
11
|
+
* border-block-start-style border-top-style
|
|
12
|
+
* border-block-start-width border-top-width
|
|
13
|
+
* border-inline-end border-right
|
|
14
|
+
* border-inline-end-color border-right-color
|
|
15
|
+
* border-inline-end-style border-right-style
|
|
16
|
+
* border-inline-end-width border-right-width
|
|
17
|
+
* border-inline-start border-left
|
|
18
|
+
* border-inline-start-color border-left-color
|
|
19
|
+
* border-inline-start-style border-left-style
|
|
20
|
+
* border-inline-start-width border-left-width
|
|
21
|
+
* border-start-start-radius border-top-left-radius
|
|
22
|
+
* border-end-start-radius border-bottom-left-radius
|
|
23
|
+
* border-start-end-radius border-top-right-radius
|
|
24
|
+
* border-end-end-radius border-bottom-right-radius
|
|
25
|
+
* margin-block-end margin-bottom
|
|
26
|
+
* margin-block-start margin-top
|
|
27
|
+
* margin-inline-end margin-right
|
|
28
|
+
* margin-inline-start margin-left
|
|
29
|
+
* padding-block-end padding-bottom
|
|
30
|
+
* padding-block-start padding-top
|
|
31
|
+
* padding-inline-end padding-right
|
|
32
|
+
* padding-inline-start padding-left
|
|
33
|
+
* inset-inline-start left
|
|
34
|
+
* inset-inline-end right
|
|
35
|
+
* inset-block-start top
|
|
36
|
+
* inset-block-end bottom
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export var logicalPhysicalMap = {
|
|
40
|
+
borderBlockEnd: 'borderBottom',
|
|
41
|
+
borderBlockEndColor: 'borderBottomColor',
|
|
42
|
+
borderBlockEndStyle: 'borderBottomStyle',
|
|
43
|
+
borderBlockEndWidth: 'borderBottomWidth',
|
|
44
|
+
borderBlockStart: 'borderTop',
|
|
45
|
+
borderBlockStartColor: 'borderTopColor',
|
|
46
|
+
borderBlockStartStyle: 'borderTopStyle',
|
|
47
|
+
borderBlockStartWidth: 'borderTopWidth',
|
|
48
|
+
borderInlineEnd: 'borderRight',
|
|
49
|
+
borderInlineEndColor: 'borderRightColor',
|
|
50
|
+
borderInlineEndStyle: 'borderRightStyle',
|
|
51
|
+
borderInlineEndWidth: 'borderRightWidth',
|
|
52
|
+
borderInlineStart: 'borderLeft',
|
|
53
|
+
borderInlineStartColor: 'borderLeftColor',
|
|
54
|
+
borderInlineStartStyle: 'borderLeftStyle',
|
|
55
|
+
borderInlineStartWidth: 'borderLeftWidth',
|
|
56
|
+
borderStartStartRadius: 'borderTopLeftRadius',
|
|
57
|
+
borderEndStartRadius: 'borderBottomLeftRadius',
|
|
58
|
+
borderStartEndRadius: 'borderTopRightRadius',
|
|
59
|
+
borderEndEndRadius: 'borderBottomRightRadius',
|
|
60
|
+
marginBlockEnd: 'marginBottom',
|
|
61
|
+
marginBlockStart: 'marginTop',
|
|
62
|
+
marginInlineEnd: 'marginRight',
|
|
63
|
+
marginInlineStart: 'marginLeft',
|
|
64
|
+
paddingBlockEnd: 'paddingBottom',
|
|
65
|
+
paddingBlockStart: 'paddingTop',
|
|
66
|
+
paddingInlineEnd: 'paddingRight',
|
|
67
|
+
paddingInlineStart: 'paddingLeft',
|
|
68
|
+
insetInlineStart: 'left',
|
|
69
|
+
insetInlineEnd: 'right',
|
|
70
|
+
insetBlockStart: 'top',
|
|
71
|
+
insetBlockEnd: 'bottom'
|
|
72
|
+
};
|
|
73
|
+
export var physicalLogicalMap = {
|
|
74
|
+
borderBottom: 'borderBlockEnd',
|
|
75
|
+
borderBottomColor: 'borderBlockEndColor',
|
|
76
|
+
borderBottomStyle: 'borderBlockEndStyle',
|
|
77
|
+
borderBottomWidth: 'borderBlockEndWidth',
|
|
78
|
+
borderTop: 'borderBlockStart',
|
|
79
|
+
borderTopColor: 'borderBlockStartColor',
|
|
80
|
+
borderTopStyle: 'borderBlockStartStyle',
|
|
81
|
+
borderTopWidth: 'borderBlockStartWidth',
|
|
82
|
+
borderRight: 'borderInlineEnd',
|
|
83
|
+
borderRightColor: 'borderInlineEndColor',
|
|
84
|
+
borderRightStyle: 'borderInlineEndStyle',
|
|
85
|
+
borderRightWidth: 'borderInlineEndWidth',
|
|
86
|
+
borderLeft: 'borderInlineStart',
|
|
87
|
+
borderLeftColor: 'borderInlineStartColor',
|
|
88
|
+
borderLeftStyle: 'borderInlineStartStyle',
|
|
89
|
+
borderLeftWidth: 'borderInlineStartWidth',
|
|
90
|
+
borderTopLeftRadius: 'borderStartStartRadius',
|
|
91
|
+
borderBottomLeftRadius: 'borderEndStartRadius',
|
|
92
|
+
borderTopRightRadius: 'borderStartEndRadius',
|
|
93
|
+
borderBottomRightRadius: 'borderEndEndRadius',
|
|
94
|
+
marginBottom: 'marginBlockEnd',
|
|
95
|
+
marginTop: 'marginBlockStart',
|
|
96
|
+
marginRight: 'marginInlineEnd',
|
|
97
|
+
marginLeft: 'marginInlineStart',
|
|
98
|
+
paddingBottom: 'paddingBlockEnd',
|
|
99
|
+
paddingTop: 'paddingBlockStart',
|
|
100
|
+
paddingRight: 'paddingInlineEnd',
|
|
101
|
+
paddingLeft: 'paddingInlineStart',
|
|
102
|
+
left: 'insetInlineStart',
|
|
103
|
+
right: 'insetInlineEnd',
|
|
104
|
+
top: 'insetBlockStart',
|
|
105
|
+
bottom: 'insetBlockEnd'
|
|
106
|
+
};
|
|
@@ -13,6 +13,7 @@ export declare const configs: {
|
|
|
13
13
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
14
14
|
'@atlaskit/design-system/no-margin': string;
|
|
15
15
|
'@atlaskit/design-system/no-nested-styles': string;
|
|
16
|
+
'@atlaskit/design-system/no-physical-properties': string;
|
|
16
17
|
'@atlaskit/design-system/no-unsafe-design-token-usage': string;
|
|
17
18
|
'@atlaskit/design-system/prefer-primitives': string;
|
|
18
19
|
'@atlaskit/design-system/use-primitives': string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::0dad73a6ffc9bd6b08475ff31c542817>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -16,6 +16,7 @@ declare const _default: {
|
|
|
16
16
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
17
17
|
'@atlaskit/design-system/no-margin': string;
|
|
18
18
|
'@atlaskit/design-system/no-nested-styles': string;
|
|
19
|
+
'@atlaskit/design-system/no-physical-properties': string;
|
|
19
20
|
'@atlaskit/design-system/no-unsafe-design-token-usage': string;
|
|
20
21
|
'@atlaskit/design-system/prefer-primitives': string;
|
|
21
22
|
'@atlaskit/design-system/use-primitives': string;
|
|
@@ -13,6 +13,7 @@ declare const _default: {
|
|
|
13
13
|
}], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
14
14
|
'no-margin': import("eslint").Rule.RuleModule;
|
|
15
15
|
'no-nested-styles': import("eslint").Rule.RuleModule;
|
|
16
|
+
'no-physical-properties': import("eslint").Rule.RuleModule;
|
|
16
17
|
'no-unsafe-design-token-usage': import("eslint").Rule.RuleModule;
|
|
17
18
|
'prefer-primitives': import("eslint").Rule.RuleModule;
|
|
18
19
|
'use-primitives': import("eslint").Rule.RuleModule;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logical property to physical property map
|
|
3
|
+
* @example
|
|
4
|
+
* ```
|
|
5
|
+
* border-block-end border-bottom
|
|
6
|
+
* border-block-end-color border-bottom-color
|
|
7
|
+
* border-block-end-style border-bottom-style
|
|
8
|
+
* border-block-end-width border-bottom-width
|
|
9
|
+
* border-block-start border-top
|
|
10
|
+
* border-block-start-color border-top-color
|
|
11
|
+
* border-block-start-style border-top-style
|
|
12
|
+
* border-block-start-width border-top-width
|
|
13
|
+
* border-inline-end border-right
|
|
14
|
+
* border-inline-end-color border-right-color
|
|
15
|
+
* border-inline-end-style border-right-style
|
|
16
|
+
* border-inline-end-width border-right-width
|
|
17
|
+
* border-inline-start border-left
|
|
18
|
+
* border-inline-start-color border-left-color
|
|
19
|
+
* border-inline-start-style border-left-style
|
|
20
|
+
* border-inline-start-width border-left-width
|
|
21
|
+
* border-start-start-radius border-top-left-radius
|
|
22
|
+
* border-end-start-radius border-bottom-left-radius
|
|
23
|
+
* border-start-end-radius border-top-right-radius
|
|
24
|
+
* border-end-end-radius border-bottom-right-radius
|
|
25
|
+
* margin-block-end margin-bottom
|
|
26
|
+
* margin-block-start margin-top
|
|
27
|
+
* margin-inline-end margin-right
|
|
28
|
+
* margin-inline-start margin-left
|
|
29
|
+
* padding-block-end padding-bottom
|
|
30
|
+
* padding-block-start padding-top
|
|
31
|
+
* padding-inline-end padding-right
|
|
32
|
+
* padding-inline-start padding-left
|
|
33
|
+
* inset-inline-start left
|
|
34
|
+
* inset-inline-end right
|
|
35
|
+
* inset-block-start top
|
|
36
|
+
* inset-block-end bottom
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare const logicalPhysicalMap: {
|
|
40
|
+
readonly borderBlockEnd: "borderBottom";
|
|
41
|
+
readonly borderBlockEndColor: "borderBottomColor";
|
|
42
|
+
readonly borderBlockEndStyle: "borderBottomStyle";
|
|
43
|
+
readonly borderBlockEndWidth: "borderBottomWidth";
|
|
44
|
+
readonly borderBlockStart: "borderTop";
|
|
45
|
+
readonly borderBlockStartColor: "borderTopColor";
|
|
46
|
+
readonly borderBlockStartStyle: "borderTopStyle";
|
|
47
|
+
readonly borderBlockStartWidth: "borderTopWidth";
|
|
48
|
+
readonly borderInlineEnd: "borderRight";
|
|
49
|
+
readonly borderInlineEndColor: "borderRightColor";
|
|
50
|
+
readonly borderInlineEndStyle: "borderRightStyle";
|
|
51
|
+
readonly borderInlineEndWidth: "borderRightWidth";
|
|
52
|
+
readonly borderInlineStart: "borderLeft";
|
|
53
|
+
readonly borderInlineStartColor: "borderLeftColor";
|
|
54
|
+
readonly borderInlineStartStyle: "borderLeftStyle";
|
|
55
|
+
readonly borderInlineStartWidth: "borderLeftWidth";
|
|
56
|
+
readonly borderStartStartRadius: "borderTopLeftRadius";
|
|
57
|
+
readonly borderEndStartRadius: "borderBottomLeftRadius";
|
|
58
|
+
readonly borderStartEndRadius: "borderTopRightRadius";
|
|
59
|
+
readonly borderEndEndRadius: "borderBottomRightRadius";
|
|
60
|
+
readonly marginBlockEnd: "marginBottom";
|
|
61
|
+
readonly marginBlockStart: "marginTop";
|
|
62
|
+
readonly marginInlineEnd: "marginRight";
|
|
63
|
+
readonly marginInlineStart: "marginLeft";
|
|
64
|
+
readonly paddingBlockEnd: "paddingBottom";
|
|
65
|
+
readonly paddingBlockStart: "paddingTop";
|
|
66
|
+
readonly paddingInlineEnd: "paddingRight";
|
|
67
|
+
readonly paddingInlineStart: "paddingLeft";
|
|
68
|
+
readonly insetInlineStart: "left";
|
|
69
|
+
readonly insetInlineEnd: "right";
|
|
70
|
+
readonly insetBlockStart: "top";
|
|
71
|
+
readonly insetBlockEnd: "bottom";
|
|
72
|
+
};
|
|
73
|
+
export declare const physicalLogicalMap: {
|
|
74
|
+
readonly borderBottom: "borderBlockEnd";
|
|
75
|
+
readonly borderBottomColor: "borderBlockEndColor";
|
|
76
|
+
readonly borderBottomStyle: "borderBlockEndStyle";
|
|
77
|
+
readonly borderBottomWidth: "borderBlockEndWidth";
|
|
78
|
+
readonly borderTop: "borderBlockStart";
|
|
79
|
+
readonly borderTopColor: "borderBlockStartColor";
|
|
80
|
+
readonly borderTopStyle: "borderBlockStartStyle";
|
|
81
|
+
readonly borderTopWidth: "borderBlockStartWidth";
|
|
82
|
+
readonly borderRight: "borderInlineEnd";
|
|
83
|
+
readonly borderRightColor: "borderInlineEndColor";
|
|
84
|
+
readonly borderRightStyle: "borderInlineEndStyle";
|
|
85
|
+
readonly borderRightWidth: "borderInlineEndWidth";
|
|
86
|
+
readonly borderLeft: "borderInlineStart";
|
|
87
|
+
readonly borderLeftColor: "borderInlineStartColor";
|
|
88
|
+
readonly borderLeftStyle: "borderInlineStartStyle";
|
|
89
|
+
readonly borderLeftWidth: "borderInlineStartWidth";
|
|
90
|
+
readonly borderTopLeftRadius: "borderStartStartRadius";
|
|
91
|
+
readonly borderBottomLeftRadius: "borderEndStartRadius";
|
|
92
|
+
readonly borderTopRightRadius: "borderStartEndRadius";
|
|
93
|
+
readonly borderBottomRightRadius: "borderEndEndRadius";
|
|
94
|
+
readonly marginBottom: "marginBlockEnd";
|
|
95
|
+
readonly marginTop: "marginBlockStart";
|
|
96
|
+
readonly marginRight: "marginInlineEnd";
|
|
97
|
+
readonly marginLeft: "marginInlineStart";
|
|
98
|
+
readonly paddingBottom: "paddingBlockEnd";
|
|
99
|
+
readonly paddingTop: "paddingBlockStart";
|
|
100
|
+
readonly paddingRight: "paddingInlineEnd";
|
|
101
|
+
readonly paddingLeft: "paddingInlineStart";
|
|
102
|
+
readonly left: "insetInlineStart";
|
|
103
|
+
readonly right: "insetInlineEnd";
|
|
104
|
+
readonly top: "insetBlockStart";
|
|
105
|
+
readonly bottom: "insetBlockEnd";
|
|
106
|
+
};
|
|
@@ -13,6 +13,7 @@ export declare const configs: {
|
|
|
13
13
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
14
14
|
'@atlaskit/design-system/no-margin': string;
|
|
15
15
|
'@atlaskit/design-system/no-nested-styles': string;
|
|
16
|
+
'@atlaskit/design-system/no-physical-properties': string;
|
|
16
17
|
'@atlaskit/design-system/no-unsafe-design-token-usage': string;
|
|
17
18
|
'@atlaskit/design-system/prefer-primitives': string;
|
|
18
19
|
'@atlaskit/design-system/use-primitives': string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::0dad73a6ffc9bd6b08475ff31c542817>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -16,6 +16,7 @@ declare const _default: {
|
|
|
16
16
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
17
17
|
'@atlaskit/design-system/no-margin': string;
|
|
18
18
|
'@atlaskit/design-system/no-nested-styles': string;
|
|
19
|
+
'@atlaskit/design-system/no-physical-properties': string;
|
|
19
20
|
'@atlaskit/design-system/no-unsafe-design-token-usage': string;
|
|
20
21
|
'@atlaskit/design-system/prefer-primitives': string;
|
|
21
22
|
'@atlaskit/design-system/use-primitives': string;
|
|
@@ -17,6 +17,7 @@ declare const _default: {
|
|
|
17
17
|
], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
18
18
|
'no-margin': import("eslint").Rule.RuleModule;
|
|
19
19
|
'no-nested-styles': import("eslint").Rule.RuleModule;
|
|
20
|
+
'no-physical-properties': import("eslint").Rule.RuleModule;
|
|
20
21
|
'no-unsafe-design-token-usage': import("eslint").Rule.RuleModule;
|
|
21
22
|
'prefer-primitives': import("eslint").Rule.RuleModule;
|
|
22
23
|
'use-primitives': import("eslint").Rule.RuleModule;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logical property to physical property map
|
|
3
|
+
* @example
|
|
4
|
+
* ```
|
|
5
|
+
* border-block-end border-bottom
|
|
6
|
+
* border-block-end-color border-bottom-color
|
|
7
|
+
* border-block-end-style border-bottom-style
|
|
8
|
+
* border-block-end-width border-bottom-width
|
|
9
|
+
* border-block-start border-top
|
|
10
|
+
* border-block-start-color border-top-color
|
|
11
|
+
* border-block-start-style border-top-style
|
|
12
|
+
* border-block-start-width border-top-width
|
|
13
|
+
* border-inline-end border-right
|
|
14
|
+
* border-inline-end-color border-right-color
|
|
15
|
+
* border-inline-end-style border-right-style
|
|
16
|
+
* border-inline-end-width border-right-width
|
|
17
|
+
* border-inline-start border-left
|
|
18
|
+
* border-inline-start-color border-left-color
|
|
19
|
+
* border-inline-start-style border-left-style
|
|
20
|
+
* border-inline-start-width border-left-width
|
|
21
|
+
* border-start-start-radius border-top-left-radius
|
|
22
|
+
* border-end-start-radius border-bottom-left-radius
|
|
23
|
+
* border-start-end-radius border-top-right-radius
|
|
24
|
+
* border-end-end-radius border-bottom-right-radius
|
|
25
|
+
* margin-block-end margin-bottom
|
|
26
|
+
* margin-block-start margin-top
|
|
27
|
+
* margin-inline-end margin-right
|
|
28
|
+
* margin-inline-start margin-left
|
|
29
|
+
* padding-block-end padding-bottom
|
|
30
|
+
* padding-block-start padding-top
|
|
31
|
+
* padding-inline-end padding-right
|
|
32
|
+
* padding-inline-start padding-left
|
|
33
|
+
* inset-inline-start left
|
|
34
|
+
* inset-inline-end right
|
|
35
|
+
* inset-block-start top
|
|
36
|
+
* inset-block-end bottom
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare const logicalPhysicalMap: {
|
|
40
|
+
readonly borderBlockEnd: "borderBottom";
|
|
41
|
+
readonly borderBlockEndColor: "borderBottomColor";
|
|
42
|
+
readonly borderBlockEndStyle: "borderBottomStyle";
|
|
43
|
+
readonly borderBlockEndWidth: "borderBottomWidth";
|
|
44
|
+
readonly borderBlockStart: "borderTop";
|
|
45
|
+
readonly borderBlockStartColor: "borderTopColor";
|
|
46
|
+
readonly borderBlockStartStyle: "borderTopStyle";
|
|
47
|
+
readonly borderBlockStartWidth: "borderTopWidth";
|
|
48
|
+
readonly borderInlineEnd: "borderRight";
|
|
49
|
+
readonly borderInlineEndColor: "borderRightColor";
|
|
50
|
+
readonly borderInlineEndStyle: "borderRightStyle";
|
|
51
|
+
readonly borderInlineEndWidth: "borderRightWidth";
|
|
52
|
+
readonly borderInlineStart: "borderLeft";
|
|
53
|
+
readonly borderInlineStartColor: "borderLeftColor";
|
|
54
|
+
readonly borderInlineStartStyle: "borderLeftStyle";
|
|
55
|
+
readonly borderInlineStartWidth: "borderLeftWidth";
|
|
56
|
+
readonly borderStartStartRadius: "borderTopLeftRadius";
|
|
57
|
+
readonly borderEndStartRadius: "borderBottomLeftRadius";
|
|
58
|
+
readonly borderStartEndRadius: "borderTopRightRadius";
|
|
59
|
+
readonly borderEndEndRadius: "borderBottomRightRadius";
|
|
60
|
+
readonly marginBlockEnd: "marginBottom";
|
|
61
|
+
readonly marginBlockStart: "marginTop";
|
|
62
|
+
readonly marginInlineEnd: "marginRight";
|
|
63
|
+
readonly marginInlineStart: "marginLeft";
|
|
64
|
+
readonly paddingBlockEnd: "paddingBottom";
|
|
65
|
+
readonly paddingBlockStart: "paddingTop";
|
|
66
|
+
readonly paddingInlineEnd: "paddingRight";
|
|
67
|
+
readonly paddingInlineStart: "paddingLeft";
|
|
68
|
+
readonly insetInlineStart: "left";
|
|
69
|
+
readonly insetInlineEnd: "right";
|
|
70
|
+
readonly insetBlockStart: "top";
|
|
71
|
+
readonly insetBlockEnd: "bottom";
|
|
72
|
+
};
|
|
73
|
+
export declare const physicalLogicalMap: {
|
|
74
|
+
readonly borderBottom: "borderBlockEnd";
|
|
75
|
+
readonly borderBottomColor: "borderBlockEndColor";
|
|
76
|
+
readonly borderBottomStyle: "borderBlockEndStyle";
|
|
77
|
+
readonly borderBottomWidth: "borderBlockEndWidth";
|
|
78
|
+
readonly borderTop: "borderBlockStart";
|
|
79
|
+
readonly borderTopColor: "borderBlockStartColor";
|
|
80
|
+
readonly borderTopStyle: "borderBlockStartStyle";
|
|
81
|
+
readonly borderTopWidth: "borderBlockStartWidth";
|
|
82
|
+
readonly borderRight: "borderInlineEnd";
|
|
83
|
+
readonly borderRightColor: "borderInlineEndColor";
|
|
84
|
+
readonly borderRightStyle: "borderInlineEndStyle";
|
|
85
|
+
readonly borderRightWidth: "borderInlineEndWidth";
|
|
86
|
+
readonly borderLeft: "borderInlineStart";
|
|
87
|
+
readonly borderLeftColor: "borderInlineStartColor";
|
|
88
|
+
readonly borderLeftStyle: "borderInlineStartStyle";
|
|
89
|
+
readonly borderLeftWidth: "borderInlineStartWidth";
|
|
90
|
+
readonly borderTopLeftRadius: "borderStartStartRadius";
|
|
91
|
+
readonly borderBottomLeftRadius: "borderEndStartRadius";
|
|
92
|
+
readonly borderTopRightRadius: "borderStartEndRadius";
|
|
93
|
+
readonly borderBottomRightRadius: "borderEndEndRadius";
|
|
94
|
+
readonly marginBottom: "marginBlockEnd";
|
|
95
|
+
readonly marginTop: "marginBlockStart";
|
|
96
|
+
readonly marginRight: "marginInlineEnd";
|
|
97
|
+
readonly marginLeft: "marginInlineStart";
|
|
98
|
+
readonly paddingBottom: "paddingBlockEnd";
|
|
99
|
+
readonly paddingTop: "paddingBlockStart";
|
|
100
|
+
readonly paddingRight: "paddingInlineEnd";
|
|
101
|
+
readonly paddingLeft: "paddingInlineStart";
|
|
102
|
+
readonly left: "insetInlineStart";
|
|
103
|
+
readonly right: "insetInlineEnd";
|
|
104
|
+
readonly top: "insetBlockStart";
|
|
105
|
+
readonly bottom: "insetBlockEnd";
|
|
106
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/eslint-plugin-design-system",
|
|
3
3
|
"description": "The essential plugin for use with the Atlassian Design System.",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.7.0",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"registry": "https://registry.npmjs.org/"
|
package/report.api.md
CHANGED
|
@@ -34,6 +34,7 @@ export const configs: {
|
|
|
34
34
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
35
35
|
'@atlaskit/design-system/no-margin': string;
|
|
36
36
|
'@atlaskit/design-system/no-nested-styles': string;
|
|
37
|
+
'@atlaskit/design-system/no-physical-properties': string;
|
|
37
38
|
'@atlaskit/design-system/no-unsafe-design-token-usage': string;
|
|
38
39
|
'@atlaskit/design-system/prefer-primitives': string;
|
|
39
40
|
'@atlaskit/design-system/use-primitives': string;
|
|
@@ -120,6 +121,7 @@ export const rules: {
|
|
|
120
121
|
>;
|
|
121
122
|
'no-margin': Rule.RuleModule;
|
|
122
123
|
'no-nested-styles': Rule.RuleModule;
|
|
124
|
+
'no-physical-properties': Rule.RuleModule;
|
|
123
125
|
'no-unsafe-design-token-usage': Rule.RuleModule;
|
|
124
126
|
'prefer-primitives': Rule.RuleModule;
|
|
125
127
|
'use-primitives': Rule.RuleModule;
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export const configs: {
|
|
|
23
23
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
24
24
|
'@atlaskit/design-system/no-margin': string;
|
|
25
25
|
'@atlaskit/design-system/no-nested-styles': string;
|
|
26
|
+
'@atlaskit/design-system/no-physical-properties': string;
|
|
26
27
|
'@atlaskit/design-system/no-unsafe-design-token-usage': string;
|
|
27
28
|
'@atlaskit/design-system/prefer-primitives': string;
|
|
28
29
|
'@atlaskit/design-system/use-primitives': string;
|
|
@@ -94,6 +95,7 @@ export const rules: {
|
|
|
94
95
|
}], RuleListener>;
|
|
95
96
|
'no-margin': Rule.RuleModule;
|
|
96
97
|
'no-nested-styles': Rule.RuleModule;
|
|
98
|
+
'no-physical-properties': Rule.RuleModule;
|
|
97
99
|
'no-unsafe-design-token-usage': Rule.RuleModule;
|
|
98
100
|
'prefer-primitives': Rule.RuleModule;
|
|
99
101
|
'use-primitives': Rule.RuleModule;
|