@atlaskit/eslint-plugin-design-system 13.19.5 → 13.20.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
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 13.20.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`e8f8ff85f4834`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e8f8ff85f4834) -
|
|
8
|
+
Add cssmap support for no-physical-properties rule
|
|
9
|
+
|
|
10
|
+
## 13.19.6
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`23bcc5bbc9cee`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/23bcc5bbc9cee) -
|
|
15
|
+
Internal changes to how border radius is applied.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 13.19.5
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -85,7 +85,7 @@ module.exports = {
|
|
|
85
85
|
| <a href="./packages/design-system/eslint-plugin/src/rules/no-legacy-icons/README.md">no-legacy-icons</a> | Enforces no legacy icons are used. | | Yes | Yes |
|
|
86
86
|
| <a href="./packages/design-system/eslint-plugin/src/rules/no-margin/README.md">no-margin</a> | Disallow using the margin CSS property. | | | |
|
|
87
87
|
| <a href="./packages/design-system/eslint-plugin/src/rules/no-nested-styles/README.md">no-nested-styles</a> | Disallows use of nested styles in `css` functions. | Yes | | |
|
|
88
|
-
| <a href="./packages/design-system/eslint-plugin/src/rules/no-physical-properties/README.md">no-physical-properties</a> | Disallow physical properties and values in `css` function calls.
|
|
88
|
+
| <a href="./packages/design-system/eslint-plugin/src/rules/no-physical-properties/README.md">no-physical-properties</a> | Disallow physical properties and values in `css` and `cssMap` function calls. | | Yes | |
|
|
89
89
|
| <a href="./packages/design-system/eslint-plugin/src/rules/no-separator-with-list-elements/README.md">no-separator-with-list-elements</a> | Warn when the `separator` prop is used with `as="li"`, `as="ol"`, or `as="dl"` in the Inline component. | Yes | | |
|
|
90
90
|
| <a href="./packages/design-system/eslint-plugin/src/rules/no-styled-tagged-template-expression/README.md">no-styled-tagged-template-expression</a> | Disallows any `styled` tagged template expressions that originate from Emotion, Styled Components or Compiled | | Yes | |
|
|
91
91
|
| <a href="./packages/design-system/eslint-plugin/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 | |
|
|
@@ -12,17 +12,18 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
12
12
|
name: 'no-physical-properties',
|
|
13
13
|
fixable: 'code',
|
|
14
14
|
docs: {
|
|
15
|
-
description: 'Disallow physical properties and values in `css` function calls.',
|
|
15
|
+
description: 'Disallow physical properties and values in `css` and `cssMap` function calls.',
|
|
16
16
|
recommended: false,
|
|
17
17
|
severity: 'error'
|
|
18
18
|
},
|
|
19
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.'
|
|
20
|
+
noPhysicalProperties: 'Physical properties are not allowed in `css` and `cssMap` functions as they do not support different reading modes. Use a logical property instead.',
|
|
21
|
+
noPhysicalValues: 'Physical values are not allowed in `css` and `cssMap` functions.'
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
create: function create(context) {
|
|
25
25
|
return {
|
|
26
|
+
// Handle css() calls
|
|
26
27
|
'CallExpression[callee.name=css] > ObjectExpression Property,CallExpression[callee.name=xcss] > ObjectExpression Property': function CallExpressionCalleeNameCss__ObjectExpression_PropertyCallExpressionCalleeNameXcss__ObjectExpression_Property(node) {
|
|
27
28
|
if (!(0, _eslintCodemodUtils.isNodeOfType)(node, 'Property')) {
|
|
28
29
|
return;
|
|
@@ -41,6 +42,26 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
41
42
|
}
|
|
42
43
|
});
|
|
43
44
|
}
|
|
45
|
+
},
|
|
46
|
+
// Handle cssMap() calls
|
|
47
|
+
'CallExpression[callee.name=cssMap] > ObjectExpression Property > ObjectExpression Property': function CallExpressionCalleeNameCssMap__ObjectExpression_Property__ObjectExpression_Property(node) {
|
|
48
|
+
if (!(0, _eslintCodemodUtils.isNodeOfType)(node, 'Property')) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (!(0, _eslintCodemodUtils.isNodeOfType)(node.key, 'Identifier')) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
var key = node.key;
|
|
55
|
+
if (key.name in _logicalPhysicalMap.physicalLogicalMap) {
|
|
56
|
+
context.report({
|
|
57
|
+
node: key,
|
|
58
|
+
messageId: 'noPhysicalProperties',
|
|
59
|
+
fix: function fix(fixer) {
|
|
60
|
+
var logicalProperty = _logicalPhysicalMap.physicalLogicalMap[key.name];
|
|
61
|
+
return fixer.replaceText(key, logicalProperty);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
44
65
|
}
|
|
45
66
|
};
|
|
46
67
|
}
|
|
@@ -6,17 +6,18 @@ const rule = createLintRule({
|
|
|
6
6
|
name: 'no-physical-properties',
|
|
7
7
|
fixable: 'code',
|
|
8
8
|
docs: {
|
|
9
|
-
description: 'Disallow physical properties and values in `css` function calls.',
|
|
9
|
+
description: 'Disallow physical properties and values in `css` and `cssMap` function calls.',
|
|
10
10
|
recommended: false,
|
|
11
11
|
severity: 'error'
|
|
12
12
|
},
|
|
13
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.'
|
|
14
|
+
noPhysicalProperties: 'Physical properties are not allowed in `css` and `cssMap` functions as they do not support different reading modes. Use a logical property instead.',
|
|
15
|
+
noPhysicalValues: 'Physical values are not allowed in `css` and `cssMap` functions.'
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
create(context) {
|
|
19
19
|
return {
|
|
20
|
+
// Handle css() calls
|
|
20
21
|
'CallExpression[callee.name=css] > ObjectExpression Property,CallExpression[callee.name=xcss] > ObjectExpression Property': node => {
|
|
21
22
|
if (!isNodeOfType(node, 'Property')) {
|
|
22
23
|
return;
|
|
@@ -37,6 +38,28 @@ const rule = createLintRule({
|
|
|
37
38
|
}
|
|
38
39
|
});
|
|
39
40
|
}
|
|
41
|
+
},
|
|
42
|
+
// Handle cssMap() calls
|
|
43
|
+
'CallExpression[callee.name=cssMap] > ObjectExpression Property > ObjectExpression Property': node => {
|
|
44
|
+
if (!isNodeOfType(node, 'Property')) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (!isNodeOfType(node.key, 'Identifier')) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const {
|
|
51
|
+
key
|
|
52
|
+
} = node;
|
|
53
|
+
if (key.name in physicalLogicalMap) {
|
|
54
|
+
context.report({
|
|
55
|
+
node: key,
|
|
56
|
+
messageId: 'noPhysicalProperties',
|
|
57
|
+
fix: fixer => {
|
|
58
|
+
const logicalProperty = physicalLogicalMap[key.name];
|
|
59
|
+
return fixer.replaceText(key, logicalProperty);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
40
63
|
}
|
|
41
64
|
};
|
|
42
65
|
}
|
|
@@ -6,17 +6,18 @@ var rule = createLintRule({
|
|
|
6
6
|
name: 'no-physical-properties',
|
|
7
7
|
fixable: 'code',
|
|
8
8
|
docs: {
|
|
9
|
-
description: 'Disallow physical properties and values in `css` function calls.',
|
|
9
|
+
description: 'Disallow physical properties and values in `css` and `cssMap` function calls.',
|
|
10
10
|
recommended: false,
|
|
11
11
|
severity: 'error'
|
|
12
12
|
},
|
|
13
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.'
|
|
14
|
+
noPhysicalProperties: 'Physical properties are not allowed in `css` and `cssMap` functions as they do not support different reading modes. Use a logical property instead.',
|
|
15
|
+
noPhysicalValues: 'Physical values are not allowed in `css` and `cssMap` functions.'
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
create: function create(context) {
|
|
19
19
|
return {
|
|
20
|
+
// Handle css() calls
|
|
20
21
|
'CallExpression[callee.name=css] > ObjectExpression Property,CallExpression[callee.name=xcss] > ObjectExpression Property': function CallExpressionCalleeNameCss__ObjectExpression_PropertyCallExpressionCalleeNameXcss__ObjectExpression_Property(node) {
|
|
21
22
|
if (!isNodeOfType(node, 'Property')) {
|
|
22
23
|
return;
|
|
@@ -35,6 +36,26 @@ var rule = createLintRule({
|
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
38
|
}
|
|
39
|
+
},
|
|
40
|
+
// Handle cssMap() calls
|
|
41
|
+
'CallExpression[callee.name=cssMap] > ObjectExpression Property > ObjectExpression Property': function CallExpressionCalleeNameCssMap__ObjectExpression_Property__ObjectExpression_Property(node) {
|
|
42
|
+
if (!isNodeOfType(node, 'Property')) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (!isNodeOfType(node.key, 'Identifier')) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
var key = node.key;
|
|
49
|
+
if (key.name in physicalLogicalMap) {
|
|
50
|
+
context.report({
|
|
51
|
+
node: key,
|
|
52
|
+
messageId: 'noPhysicalProperties',
|
|
53
|
+
fix: function fix(fixer) {
|
|
54
|
+
var logicalProperty = physicalLogicalMap[key.name];
|
|
55
|
+
return fixer.replaceText(key, logicalProperty);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
38
59
|
}
|
|
39
60
|
};
|
|
40
61
|
}
|
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": "13.
|
|
4
|
+
"version": "13.20.0",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"publishConfig": {
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@atlaskit/eslint-utils": "^2.0.0",
|
|
46
|
-
"@atlaskit/icon": "^28.
|
|
47
|
-
"@atlaskit/icon-lab": "^5.
|
|
48
|
-
"@atlaskit/tokens": "^6.
|
|
46
|
+
"@atlaskit/icon": "^28.1.0",
|
|
47
|
+
"@atlaskit/icon-lab": "^5.7.0",
|
|
48
|
+
"@atlaskit/tokens": "^6.1.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0",
|
|
50
50
|
"@typescript-eslint/utils": "^7.1.0",
|
|
51
51
|
"ajv": "^6.12.6",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@af/formatting": "workspace:^",
|
|
61
61
|
"@atlaskit/ds-lib": "^5.0.0",
|
|
62
|
-
"@atlaskit/theme": "^
|
|
62
|
+
"@atlaskit/theme": "^20.0.0",
|
|
63
63
|
"@atlassian/codegen": "^0.1.0",
|
|
64
64
|
"@atlassian/eslint-utils": "^0.5.0",
|
|
65
65
|
"@atlassian/ts-loader": "^0.1.0",
|