@atlaskit/eslint-plugin-design-system 9.2.0 → 9.2.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/CHANGELOG.md +6 -0
- package/dist/cjs/rules/utils/create-no-tagged-template-expression-rule/index.js +1 -1
- package/dist/es2019/rules/utils/create-no-tagged-template-expression-rule/index.js +6 -6
- package/dist/esm/rules/utils/create-no-tagged-template-expression-rule/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 9.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#85899](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/85899) [`4ee3baaad3b7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4ee3baaad3b7) - Loosen our final autofix check to just ignore all interpolated keys or properties in general for all `no-*-tagged-template-expression` rules as they may result in broken code in some edge-cases.
|
|
8
|
+
|
|
3
9
|
## 9.2.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -104,7 +104,7 @@ var createNoTaggedTemplateExpressionRule = exports.createNoTaggedTemplateExpress
|
|
|
104
104
|
}
|
|
105
105
|
return _context.abrupt("return");
|
|
106
106
|
case 19:
|
|
107
|
-
if (!/\$\{
|
|
107
|
+
if (!/\$\{.*:/.test(newCode)) {
|
|
108
108
|
_context.next = 21;
|
|
109
109
|
break;
|
|
110
110
|
}
|
|
@@ -83,15 +83,14 @@ export const createNoTaggedTemplateExpressionRule = (isUsage, messageId) => cont
|
|
|
83
83
|
if (usesEmotion && !!newCode.match(/!\s*important/gm)) {
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
|
-
|
|
87
|
-
// For styled-components, we might also want to similarly disallow or autofix `styled.div({ color: props => props.color })` as it's broken too (both type and functionality). This is tracked in https://product-fabric.atlassian.net/browse/USS-26.
|
|
88
|
-
if (/\$\{.*:[\s]*\{/.test(newCode)) {
|
|
86
|
+
if (/\$\{.*:/.test(newCode)) {
|
|
89
87
|
/**
|
|
90
|
-
* If we find a variable in a
|
|
91
|
-
*
|
|
88
|
+
* If we find a variable in a property at all, we skip it. There are two reasons:
|
|
92
89
|
* - `styled-components@3.x` does not support variables in a selector (see the first example).
|
|
90
|
+
* - We cannot guarantee that the contents of a mixin will ever be valid as a property or selector (which in tagged template expressions don't have to even be called).
|
|
91
|
+
* - It's not uncommon we just get this parsing wrong altogether…
|
|
93
92
|
*
|
|
94
|
-
*
|
|
93
|
+
* // TODO: In this case, we _might_ want to convert this into a suggestion to support manual remediation, some of those code isn't bad, or it can be manually made safe…
|
|
95
94
|
*
|
|
96
95
|
* @examples
|
|
97
96
|
* ```tsx
|
|
@@ -103,6 +102,7 @@ export const createNoTaggedTemplateExpressionRule = (isUsage, messageId) => cont
|
|
|
103
102
|
* ```tsx
|
|
104
103
|
* const Component = styled.div`
|
|
105
104
|
* ${mixin()} button { color: red; }
|
|
105
|
+
* ${mixin} button { color: red; }
|
|
106
106
|
* `;
|
|
107
107
|
* ```
|
|
108
108
|
*
|
package/package.json
CHANGED