@atlaskit/eslint-plugin-design-system 8.32.0 → 8.32.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.
Files changed (22) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/constellation/no-styled-tagged-template-expression/usage.mdx +42 -0
  3. package/dist/cjs/rules/consistent-css-prop-usage/index.js +375 -334
  4. package/dist/cjs/rules/no-styled-tagged-template-expression/index.js +2 -2
  5. package/dist/cjs/rules/utils/create-no-tagged-template-expression-rule/index.js +10 -3
  6. package/dist/cjs/rules/utils/is-supported-import.js +64 -10
  7. package/dist/es2019/rules/consistent-css-prop-usage/index.js +283 -267
  8. package/dist/es2019/rules/no-styled-tagged-template-expression/index.js +1 -1
  9. package/dist/es2019/rules/utils/create-no-tagged-template-expression-rule/index.js +26 -1
  10. package/dist/es2019/rules/utils/is-supported-import.js +60 -10
  11. package/dist/esm/rules/consistent-css-prop-usage/index.js +375 -334
  12. package/dist/esm/rules/no-styled-tagged-template-expression/index.js +1 -1
  13. package/dist/esm/rules/utils/create-no-tagged-template-expression-rule/index.js +11 -4
  14. package/dist/esm/rules/utils/is-supported-import.js +63 -9
  15. package/dist/types/rules/utils/is-supported-import.d.ts +11 -0
  16. package/dist/types-ts4.5/rules/utils/is-supported-import.d.ts +11 -0
  17. package/package.json +1 -1
  18. package/dist/cjs/rules/no-styled-tagged-template-expression/is-styled.js +0 -53
  19. package/dist/es2019/rules/no-styled-tagged-template-expression/is-styled.js +0 -45
  20. package/dist/esm/rules/no-styled-tagged-template-expression/is-styled.js +0 -47
  21. package/dist/types/rules/no-styled-tagged-template-expression/is-styled.d.ts +0 -7
  22. package/dist/types-ts4.5/rules/no-styled-tagged-template-expression/is-styled.d.ts +0 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/eslint-plugin-design-system
2
2
 
3
+ ## 8.32.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#77485](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/77485) [`887b1a3193ce`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/887b1a3193ce) - For `no-styled-tagged-template-expression`, do not autofix component selectors for `styled-components` implementations
8
+
9
+ ## 8.32.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#77519](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/77519) [`6507c28d3c88`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6507c28d3c88) - Refactor implementation of `no-css-tagged-template-expression`. No change to functionality expected.
14
+
3
15
  ## 8.32.0
4
16
 
5
17
  ### Minor Changes
@@ -86,3 +86,45 @@ export const Component = styled.div``;
86
86
  ## Limitations
87
87
 
88
88
  - Comments are not fixable.
89
+ - Component selectors are not fixable for `styled-components`.
90
+
91
+ Do not migrate to this object syntax manually, it is invalid `styled-components`.
92
+
93
+ ```tsx
94
+ const Button = styled.button``;
95
+ const Wrapper = styled.div({
96
+ color: 'red',
97
+ [`${Button}`]: {
98
+ color: 'blue',
99
+ },
100
+ });
101
+ <Wrapper><Button /><Wrapper>
102
+ ```
103
+
104
+ Instead, style the button directly—make it clear that you're styling that button.
105
+
106
+ ```tsx
107
+ const buttonStyles = css({ color: 'blue' });
108
+ const Wrapper = styled.div({
109
+ color: 'red',
110
+ });
111
+
112
+ <Wrapper>
113
+ <button css={buttonStyles} />
114
+ </Wrapper>;
115
+ ```
116
+
117
+ If that's not feasible, you can use data attributes, but these will result in failing the UI Styling Standard around nested styles, pushing the error down the road.
118
+
119
+ ```tsx
120
+ const Wrapper = styled.div({
121
+ color: 'red',
122
+ '[data-component-selector="my.button"]': {
123
+ color: 'blue',
124
+ },
125
+ });
126
+
127
+ <Wrapper>
128
+ <button data-component-selector="my.button" />
129
+ </Wrapper>;
130
+ ```