@atlaskit/eslint-plugin-ui-styling-standard 0.11.3 → 0.11.5
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 +152 -53
- package/README.md +30 -3
- package/constellation/index/props.mdx +2 -9
- package/constellation/no-unsafe-values/usage.mdx +1 -1
- package/dist/cjs/rules/enforce-style-prop/index.js +39 -26
- package/dist/cjs/rules/no-important-styles/index.js +41 -29
- package/dist/es2019/rules/enforce-style-prop/index.js +34 -19
- package/dist/es2019/rules/no-important-styles/index.js +28 -30
- package/dist/esm/rules/enforce-style-prop/index.js +39 -26
- package/dist/esm/rules/no-important-styles/index.js +42 -30
- package/package.json +3 -3
- package/scripts/codegen.tsx +3 -10
- package/src/rules/enforce-style-prop/__tests__/rule.test.tsx +18 -0
- package/src/rules/enforce-style-prop/index.tsx +42 -23
- package/src/rules/no-dynamic-styles/__tests__/rule.test.tsx +16 -0
- package/src/rules/no-exported-styles/index.tsx +1 -1
- package/src/rules/no-important-styles/__tests__/rule.test.tsx +22 -9
- package/src/rules/no-important-styles/index.tsx +32 -37
- package/src/rules/no-imported-style-values/index.tsx +1 -1
- package/src/rules/no-unsafe-values/README.md +1 -1
- package/tsconfig.app.json +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,212 +1,311 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-ui-styling-standard
|
|
2
2
|
|
|
3
|
+
## 0.11.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#96532](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/96532)
|
|
8
|
+
[`d54c7df2e836`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d54c7df2e836) -
|
|
9
|
+
Editing enforce-style-prop rule to use eslint utils functions
|
|
10
|
+
|
|
11
|
+
## 0.11.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#93427](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/93427)
|
|
16
|
+
[`d6d428f334b0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d6d428f334b0) -
|
|
17
|
+
The `no-important-styles` rule now checks template literal values in style objects
|
|
18
|
+
|
|
3
19
|
## 0.11.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
6
22
|
|
|
7
|
-
-
|
|
23
|
+
- [#95279](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/95279)
|
|
24
|
+
[`813a0e8d6227`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/813a0e8d6227) -
|
|
25
|
+
Deprecating @repo/internal/compiled/selectors ESlint rule
|
|
8
26
|
|
|
9
27
|
## 0.11.2
|
|
10
28
|
|
|
11
29
|
### Patch Changes
|
|
12
30
|
|
|
13
|
-
-
|
|
31
|
+
- [#94765](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94765)
|
|
32
|
+
[`8e5a3bddb686`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8e5a3bddb686) -
|
|
33
|
+
Adding no imported style values ESlint rule
|
|
14
34
|
|
|
15
35
|
## 0.11.1
|
|
16
36
|
|
|
17
37
|
### Patch Changes
|
|
18
38
|
|
|
19
|
-
-
|
|
39
|
+
- [#92963](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/92963)
|
|
40
|
+
[`1bb8557fb0b6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1bb8557fb0b6) -
|
|
41
|
+
Added no-exported-styles eslint rule to disallow exports of css, cssMap, keyframes, styled and
|
|
42
|
+
xcss styling
|
|
20
43
|
|
|
21
44
|
## 0.11.0
|
|
22
45
|
|
|
23
46
|
### Minor Changes
|
|
24
47
|
|
|
25
|
-
-
|
|
48
|
+
- [#87213](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/87213)
|
|
49
|
+
[`fbfa5a58cf39`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fbfa5a58cf39) -
|
|
50
|
+
Adds `no-unsafe-values` rule, which forbids most dynamic styling in
|
|
51
|
+
`css`/`styled`/`keyframes`/`cssMap`/`xcss` function calls. This includes object spreading,
|
|
52
|
+
function calls, and so on.
|
|
26
53
|
|
|
27
54
|
### Patch Changes
|
|
28
55
|
|
|
29
|
-
-
|
|
56
|
+
- Updated dependencies
|
|
30
57
|
|
|
31
58
|
## 0.10.0
|
|
32
59
|
|
|
33
60
|
### Minor Changes
|
|
34
61
|
|
|
35
|
-
-
|
|
62
|
+
- [#91611](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91611)
|
|
63
|
+
[`943056d22c36`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/943056d22c36) -
|
|
64
|
+
Add `no-dynamic-styles` rule which blocks function expressions as values in style declarations.
|
|
36
65
|
|
|
37
66
|
## 0.9.1
|
|
38
67
|
|
|
39
68
|
### Patch Changes
|
|
40
69
|
|
|
41
|
-
-
|
|
70
|
+
- [#90977](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/90977)
|
|
71
|
+
[`becda03f375e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/becda03f375e) -
|
|
72
|
+
Create eslint rule to enforce style prop usage by disallowing passing static css values
|
|
42
73
|
|
|
43
74
|
## 0.9.0
|
|
44
75
|
|
|
45
76
|
### Minor Changes
|
|
46
77
|
|
|
47
|
-
-
|
|
78
|
+
- [#91840](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91840)
|
|
79
|
+
[`997a3d2d0ca0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/997a3d2d0ca0) -
|
|
80
|
+
Add `no-array-arguments` rule which prevents passing array arguments to style declaration
|
|
81
|
+
functions.
|
|
48
82
|
|
|
49
83
|
### Patch Changes
|
|
50
84
|
|
|
51
|
-
-
|
|
85
|
+
- Updated dependencies
|
|
52
86
|
|
|
53
87
|
## 0.8.4
|
|
54
88
|
|
|
55
89
|
### Patch Changes
|
|
56
90
|
|
|
57
|
-
-
|
|
91
|
+
- [#89936](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/89936)
|
|
92
|
+
[`eb8f66c5d0f3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/eb8f66c5d0f3) -
|
|
93
|
+
Add @atlaskit/eslint-plugin-ui-styling-standard to the internal Atlassian push model.
|
|
58
94
|
|
|
59
95
|
## 0.8.3
|
|
60
96
|
|
|
61
97
|
### Patch Changes
|
|
62
98
|
|
|
63
|
-
-
|
|
99
|
+
- [#87496](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/87496)
|
|
100
|
+
[`d5b439e94043`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d5b439e94043) -
|
|
101
|
+
Improve coverage of `convert-props-syntax` rule. Previously cases such as `css()` and
|
|
102
|
+
`styled(BaseComponent)()` were not covered by the rule.
|
|
64
103
|
|
|
65
104
|
## 0.8.2
|
|
66
105
|
|
|
67
106
|
### Patch Changes
|
|
68
107
|
|
|
69
|
-
-
|
|
108
|
+
- [#88753](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88753)
|
|
109
|
+
[`df5cbd4957ea`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/df5cbd4957ea) -
|
|
110
|
+
Fixed no nested selectors rule to skip @ queries, cssMap and keyFrames calls
|
|
70
111
|
|
|
71
112
|
## 0.8.1
|
|
72
113
|
|
|
73
114
|
### Patch Changes
|
|
74
115
|
|
|
75
|
-
-
|
|
76
|
-
|
|
77
|
-
-
|
|
116
|
+
- [#88029](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88029)
|
|
117
|
+
[`01d74d2899d5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/01d74d2899d5) -
|
|
118
|
+
Disabled ESlint rule convert-props-syntax on .attrs() calls
|
|
119
|
+
- [#87476](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/87476)
|
|
120
|
+
[`af296d200ad2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/af296d200ad2) -
|
|
121
|
+
Internal refactoring to use `getCreateLintRule` from `@atlaskit/eslint-utils`
|
|
122
|
+
- Updated dependencies
|
|
78
123
|
|
|
79
124
|
## 0.8.0
|
|
80
125
|
|
|
81
126
|
### Minor Changes
|
|
82
127
|
|
|
83
|
-
-
|
|
128
|
+
- [#87972](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/87972)
|
|
129
|
+
[`1f420b2c4a9f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1f420b2c4a9f) -
|
|
130
|
+
The `@atlaskit/design-system/no-styled-tagged-template-expression` rule will now lint against
|
|
131
|
+
`styled-components` by default in the preset configurations.
|
|
84
132
|
|
|
85
133
|
### Patch Changes
|
|
86
134
|
|
|
87
|
-
-
|
|
135
|
+
- [#86779](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/86779)
|
|
136
|
+
[`4b4bbf195e39`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4b4bbf195e39) -
|
|
137
|
+
Created no nested selectors eslint rule to prevent setting styles for child elements
|
|
88
138
|
|
|
89
139
|
## 0.7.2
|
|
90
140
|
|
|
91
141
|
### Patch Changes
|
|
92
142
|
|
|
93
|
-
-
|
|
94
|
-
-
|
|
143
|
+
- [#86638](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/86638)
|
|
144
|
+
[`f003f07e88e1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f003f07e88e1) -
|
|
145
|
+
Internal refactoring to use a shared `@atlaskit/eslint-utils` package
|
|
146
|
+
- Updated dependencies
|
|
95
147
|
|
|
96
148
|
## 0.7.1
|
|
97
149
|
|
|
98
150
|
### Patch Changes
|
|
99
151
|
|
|
100
|
-
-
|
|
152
|
+
- [#84413](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/84413)
|
|
153
|
+
[`2860b53c90d9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2860b53c90d9) -
|
|
154
|
+
Added eslint rule to block @container queries in css styling
|
|
101
155
|
|
|
102
156
|
## 0.7.0
|
|
103
157
|
|
|
104
158
|
### Minor Changes
|
|
105
159
|
|
|
106
|
-
-
|
|
160
|
+
- [#83454](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83454)
|
|
161
|
+
[`be8b7ad6ff8e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/be8b7ad6ff8e) -
|
|
162
|
+
Remove name autofixer from `consistent-css-prop-usage`. Variables for css / xcss / cssMap
|
|
163
|
+
functions will no longer be required to end with "Styles".
|
|
107
164
|
|
|
108
|
-
|
|
165
|
+
[BREAKING] Some rule options have been changed:
|
|
109
166
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
167
|
+
- `fixNamesOnly` and `autoFixNames` have been removed, as there is no longer an autofixer that
|
|
168
|
+
enforces variable names.
|
|
169
|
+
- If you use `fixNamesOnly: true`, we recommend switching to using `autoFix: false`.
|
|
170
|
+
- Users of the `autoFixNames` option should remove this from their configuration.
|
|
171
|
+
- `autoFix` option has been added. This controls whether the remaining autofixers should run
|
|
172
|
+
or not (e.g. hoisting `css` function calls, wrapping objects in `css` function calls), and
|
|
173
|
+
is `true` by default.
|
|
114
174
|
|
|
115
175
|
## 0.6.3
|
|
116
176
|
|
|
117
177
|
### Patch Changes
|
|
118
178
|
|
|
119
|
-
-
|
|
179
|
+
- [#83463](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83463)
|
|
180
|
+
[`fee29cf1335a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fee29cf1335a) -
|
|
181
|
+
Extend convert-props-syntax to Emotion as well as it has a type issue.
|
|
120
182
|
|
|
121
183
|
## 0.6.2
|
|
122
184
|
|
|
123
185
|
### Patch Changes
|
|
124
186
|
|
|
125
|
-
-
|
|
187
|
+
- [#83116](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83116)
|
|
188
|
+
[`8d4e99057fe0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d4e99057fe0) -
|
|
189
|
+
Upgrade Typescript from `4.9.5` to `5.4.2`
|
|
126
190
|
|
|
127
191
|
## 0.6.1
|
|
128
192
|
|
|
129
193
|
### Patch Changes
|
|
130
194
|
|
|
131
|
-
-
|
|
132
|
-
|
|
195
|
+
- [#80129](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80129)
|
|
196
|
+
[`dc0ce9161fc1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dc0ce9161fc1) -
|
|
197
|
+
Add `convert-prop-syntax` to convert invalid `styled-components` props syntax to valid
|
|
198
|
+
`styled-components` props syntax.
|
|
199
|
+
- [#79686](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/79686)
|
|
200
|
+
[`7dc7cf06a8b9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7dc7cf06a8b9) -
|
|
201
|
+
Bump @compiled/react to v0.17.0
|
|
133
202
|
|
|
134
203
|
## 0.6.0
|
|
135
204
|
|
|
136
205
|
### Minor Changes
|
|
137
206
|
|
|
138
|
-
-
|
|
207
|
+
- [#81459](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81459)
|
|
208
|
+
[`08abd3b15614`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/08abd3b15614) -
|
|
209
|
+
Adds `no-classname-prop` rule which prevents the use of `className` in JSX.
|
|
139
210
|
|
|
140
211
|
## 0.5.2
|
|
141
212
|
|
|
142
213
|
### Patch Changes
|
|
143
214
|
|
|
144
|
-
-
|
|
215
|
+
- [#81702](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81702)
|
|
216
|
+
[`04e7850f449c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/04e7850f449c) -
|
|
217
|
+
Adding a missing LICENSE for this package, updating from "UNLICENSED" to make it clear this is
|
|
218
|
+
available for use.
|
|
145
219
|
|
|
146
220
|
## 0.5.1
|
|
147
221
|
|
|
148
222
|
### Patch Changes
|
|
149
223
|
|
|
150
|
-
-
|
|
224
|
+
- [#81166](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81166)
|
|
225
|
+
[`a249a1bd29a6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a249a1bd29a6) -
|
|
226
|
+
Upgrade ESLint to version 8
|
|
151
227
|
|
|
152
228
|
## 0.5.0
|
|
153
229
|
|
|
154
230
|
### Minor Changes
|
|
155
231
|
|
|
156
|
-
-
|
|
232
|
+
- [#80523](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80523)
|
|
233
|
+
[`1fbc903e5b7b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1fbc903e5b7b) -
|
|
234
|
+
Adds `no-important-styles` rule which prevents the use of `!important` flags in style
|
|
235
|
+
declarations.
|
|
157
236
|
|
|
158
237
|
## 0.4.1
|
|
159
238
|
|
|
160
239
|
### Patch Changes
|
|
161
240
|
|
|
162
|
-
-
|
|
241
|
+
- [#76885](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/76885)
|
|
242
|
+
[`06030bc18dd4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/06030bc18dd4) -
|
|
243
|
+
Disable `styled-components` handling for `no-styled-tagged-template-expression` rule, due to
|
|
244
|
+
edge case where props are converted to output that fails typechecking.
|
|
163
245
|
|
|
164
246
|
## 0.4.0
|
|
165
247
|
|
|
166
248
|
### Minor Changes
|
|
167
249
|
|
|
168
|
-
-
|
|
250
|
+
- [#75600](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75600)
|
|
251
|
+
[`8875d9de2e5d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8875d9de2e5d) -
|
|
252
|
+
Migrates the ESLint rule from `@atlaskit/design-system/local-cx-xcss` to
|
|
253
|
+
`@atlaskit/ui-styling-standard/local-cx-xcss` and overhauls the codegen to enable better
|
|
254
|
+
documentation and rule distribution.
|
|
169
255
|
|
|
170
256
|
## 0.3.0
|
|
171
257
|
|
|
172
258
|
### Minor Changes
|
|
173
259
|
|
|
174
|
-
-
|
|
260
|
+
- [#74981](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/74981)
|
|
261
|
+
[`842300de03a1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/842300de03a1) -
|
|
262
|
+
Add the following rules:
|
|
175
263
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
264
|
+
- `consistent-css-prop-usage`: Ensures consistency with `css` and `xcss` prop usages
|
|
265
|
+
- `no-empty-styled-expression`: Forbids any styled expression to be used when passing empty
|
|
266
|
+
arguments to styled.div() (or other JSX elements).
|
|
267
|
+
- `no-exported-css`: Forbid exporting `css` function calls.
|
|
268
|
+
- `no-exported-keyframes`: Forbid exporting `keyframes` function calls.
|
|
269
|
+
- `no-invalid-css-map`: Checks the validity of a CSS map created through cssMap.
|
|
181
270
|
|
|
182
|
-
-
|
|
271
|
+
- [#72983](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/72983)
|
|
272
|
+
[`878065bfc4c0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/878065bfc4c0) -
|
|
273
|
+
Adds the following rules to the recommended preset:
|
|
183
274
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
275
|
+
- `@atlaskit/design-system/no-css-tagged-template-expression`
|
|
276
|
+
- `@atlaskit/design-system/no-keyframes-tagged-template-expression`
|
|
277
|
+
- `@atlaskit/design-system/no-styled-tagged-template-expression`
|
|
187
278
|
|
|
188
279
|
### Patch Changes
|
|
189
280
|
|
|
190
|
-
-
|
|
281
|
+
- [#75152](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75152)
|
|
282
|
+
[`c16a175d372b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c16a175d372b) -
|
|
283
|
+
Change 'error' to 'warn' to unbreak AFM platform
|
|
191
284
|
|
|
192
285
|
## 0.2.1
|
|
193
286
|
|
|
194
287
|
### Patch Changes
|
|
195
288
|
|
|
196
|
-
-
|
|
289
|
+
- [#71319](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/71319)
|
|
290
|
+
[`d716e2b5e102`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d716e2b5e102) -
|
|
291
|
+
Ensures all dependencies are properly defined
|
|
197
292
|
|
|
198
293
|
## 0.2.0
|
|
199
294
|
|
|
200
295
|
### Minor Changes
|
|
201
296
|
|
|
202
|
-
-
|
|
297
|
+
- [#69723](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/69723)
|
|
298
|
+
[`06cd0f04fefb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/06cd0f04fefb) -
|
|
299
|
+
Adds the following rules to the recommended config:
|
|
203
300
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
301
|
+
- `local-cx-xcss` - Ensures the `cx()` function is only used within the `xcss` prop
|
|
302
|
+
- `no-supress-xcss` - Disallows supressing type violations when using the `xcss` prop
|
|
303
|
+
- `no-js-xcss` - Disallows using `xcss` prop inside JavaScript files
|
|
207
304
|
|
|
208
305
|
## 0.1.0
|
|
209
306
|
|
|
210
307
|
### Minor Changes
|
|
211
308
|
|
|
212
|
-
-
|
|
309
|
+
- [#63960](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/63960)
|
|
310
|
+
[`8e3774cada83`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8e3774cada83) -
|
|
311
|
+
Created the design system styling standard package
|
package/README.md
CHANGED
|
@@ -1,10 +1,37 @@
|
|
|
1
|
-
#
|
|
1
|
+
# UI Styling Standard ESLint Plugin
|
|
2
2
|
|
|
3
|
-
The UI Styling Standard
|
|
3
|
+
The UI Styling Standard is a set of principles to guide styling UI code across Atlassian's frontend codebases and ecosystem.
|
|
4
|
+
|
|
5
|
+
These are the current ESLint rules that enforce and help comply with the UI Styling Standard today, but more are planned to support the standard over time.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
You must use the recommended config to follow the styling standards at Atlassian,
|
|
10
|
+
which will ensure compatability and performance with the design system.
|
|
11
|
+
|
|
12
|
+
```diff
|
|
13
|
+
module.exports = {
|
|
14
|
+
extends: [
|
|
15
|
+
+ 'plugin:@atlaskit/ui-styling-standard/recommended',
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
We don't recommended maintaining your own configuration.
|
|
21
|
+
If you do not use our config you will need to specify individual rules and configuration.
|
|
22
|
+
Add the plugin to your `.eslintrc.js` file and enable individual rules as you're ready to adopt.
|
|
23
|
+
|
|
24
|
+
```diff
|
|
25
|
+
module.exports = {
|
|
26
|
+
plugins: [
|
|
27
|
+
+ '@atlaskit/ui-styling-standard',
|
|
28
|
+
],
|
|
29
|
+
rules: [
|
|
30
|
+
+ '@atlaskit/ui-styling-standard/convert-props-syntax': 'warn',
|
|
31
|
+
+ '@atlaskit/design-system/local-cx-xcss': 'error',
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
```
|
|
8
35
|
|
|
9
36
|
## Rules
|
|
10
37
|
|
|
@@ -11,22 +11,15 @@ module.exports = {
|
|
|
11
11
|
|
|
12
12
|
We don't recommended maintaining your own configuration.
|
|
13
13
|
If you do not use our config you will need to specify individual rules and configuration.
|
|
14
|
-
Add the plugin to your `.eslintrc.js` file.
|
|
14
|
+
Add the plugin to your `.eslintrc.js` file and enable individual rules as you're ready to adopt.
|
|
15
15
|
|
|
16
16
|
```diff
|
|
17
17
|
module.exports = {
|
|
18
18
|
plugins: [
|
|
19
19
|
+ '@atlaskit/ui-styling-standard',
|
|
20
20
|
],
|
|
21
|
-
};
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Enable individual rules as that you're ready to adopt.
|
|
25
|
-
|
|
26
|
-
```diff
|
|
27
|
-
module.exports = {
|
|
28
21
|
rules: [
|
|
29
|
-
+ '@atlaskit/
|
|
22
|
+
+ '@atlaskit/ui-styling-standard/convert-props-syntax': 'warn',
|
|
30
23
|
+ '@atlaskit/design-system/local-cx-xcss': 'error',
|
|
31
24
|
],
|
|
32
25
|
};
|
|
@@ -6,24 +6,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.rule = exports.default = void 0;
|
|
7
7
|
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
8
8
|
var _createRule = require("../utils/create-rule");
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
var isParameter = function isParameter(context, variableName) {
|
|
9
|
+
var _allowedFunctionCalls = require("@atlaskit/eslint-utils/allowed-function-calls");
|
|
10
|
+
var _findVariable3 = require("@atlaskit/eslint-utils/find-variable");
|
|
11
|
+
var isParameter = function isParameter(context, identifier) {
|
|
15
12
|
var _findVariable;
|
|
16
|
-
var definitions = (_findVariable =
|
|
13
|
+
var definitions = (_findVariable = (0, _findVariable3.findVariable)({
|
|
14
|
+
sourceCode: context.sourceCode,
|
|
15
|
+
identifier: identifier
|
|
16
|
+
})) === null || _findVariable === void 0 ? void 0 : _findVariable.defs;
|
|
17
17
|
if (!definitions || !definitions.length) {
|
|
18
18
|
return false;
|
|
19
19
|
}
|
|
20
20
|
var result = definitions[0];
|
|
21
21
|
return result.type === 'Parameter';
|
|
22
22
|
};
|
|
23
|
-
var
|
|
23
|
+
var isIdentifierAllowed = function isIdentifierAllowed(context, identifier) {
|
|
24
24
|
var _parent;
|
|
25
|
-
var
|
|
26
|
-
|
|
25
|
+
var variable = (0, _findVariable3.findVariable)({
|
|
26
|
+
sourceCode: context.sourceCode,
|
|
27
|
+
identifier: identifier
|
|
28
|
+
});
|
|
27
29
|
if (!variable) {
|
|
28
30
|
return false;
|
|
29
31
|
}
|
|
@@ -36,7 +38,7 @@ var checkIdentifier = function checkIdentifier(context, identifier) {
|
|
|
36
38
|
|
|
37
39
|
// Checking if identifier has been destructured from props within function
|
|
38
40
|
if (variableDefinition.type === 'VariableDeclarator') {
|
|
39
|
-
var _variableDefinition$i, _variableDefinition$i2
|
|
41
|
+
var _variableDefinition$i, _variableDefinition$i2;
|
|
40
42
|
// If it's a let variable, ignore
|
|
41
43
|
if (variableDefinition.parent.kind === 'let') {
|
|
42
44
|
return true;
|
|
@@ -48,16 +50,14 @@ var checkIdentifier = function checkIdentifier(context, identifier) {
|
|
|
48
50
|
// Destructured from member expression
|
|
49
51
|
// e.g. const width = props.width
|
|
50
52
|
if (((_variableDefinition$i2 = variableDefinition.init) === null || _variableDefinition$i2 === void 0 ? void 0 : _variableDefinition$i2.type) === 'MemberExpression') {
|
|
51
|
-
|
|
52
|
-
return isParameter(context, memberIdentifierName);
|
|
53
|
+
return isParameter(context, variableDefinition.init.object);
|
|
53
54
|
}
|
|
54
55
|
// Destructured from object pattern
|
|
55
56
|
// e.g. const { width } = props
|
|
56
|
-
|
|
57
|
-
return isParameter(context, propName);
|
|
57
|
+
return isParameter(context, variableDefinition.init);
|
|
58
58
|
}
|
|
59
59
|
// If identifier has not been deconstructed from parameter or is a RestElement, report warning
|
|
60
|
-
return isParameter(context,
|
|
60
|
+
return isParameter(context, identifier);
|
|
61
61
|
};
|
|
62
62
|
function isPropertyValueAllowed(property, context) {
|
|
63
63
|
if (property.type === 'SpreadElement') {
|
|
@@ -67,26 +67,39 @@ function isPropertyValueAllowed(property, context) {
|
|
|
67
67
|
if (property.value.type === 'Literal') {
|
|
68
68
|
return false;
|
|
69
69
|
} else if (property.value.type === 'Identifier') {
|
|
70
|
-
return
|
|
71
|
-
} else if (property.value.type === 'CallExpression' && property.value.callee.type === 'Identifier'
|
|
72
|
-
|
|
70
|
+
return isIdentifierAllowed(context, property.value);
|
|
71
|
+
} else if (property.value.type === 'CallExpression' && property.value.callee.type === 'Identifier') {
|
|
72
|
+
var variable = (0, _findVariable3.findVariable)({
|
|
73
|
+
sourceCode: context.sourceCode,
|
|
74
|
+
identifier: property.value.callee
|
|
75
|
+
});
|
|
76
|
+
// Anything returned by getAllowedFunctionCalls should be used in css prop instead
|
|
77
|
+
var functionAllowList = (0, _allowedFunctionCalls.getAllowedFunctionCalls)(context.options);
|
|
78
|
+
if (!variable || (0, _allowedFunctionCalls.isAllowListedVariable)({
|
|
79
|
+
allowList: functionAllowList,
|
|
80
|
+
variable: variable
|
|
81
|
+
})) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
73
84
|
} else if (property.value.type === 'MemberExpression' && property.value.object.type === 'Identifier') {
|
|
74
85
|
var _findVariable2;
|
|
75
|
-
var
|
|
76
|
-
|
|
86
|
+
var definitions = (_findVariable2 = (0, _findVariable3.findVariable)({
|
|
87
|
+
sourceCode: context.sourceCode,
|
|
88
|
+
identifier: property.value.object
|
|
89
|
+
})) === null || _findVariable2 === void 0 ? void 0 : _findVariable2.defs;
|
|
77
90
|
if (!definitions || !definitions.length) {
|
|
78
91
|
return false;
|
|
79
92
|
}
|
|
80
|
-
var
|
|
81
|
-
if (!
|
|
93
|
+
var _variable = definitions[0];
|
|
94
|
+
if (!_variable) {
|
|
82
95
|
return false;
|
|
83
96
|
}
|
|
84
|
-
var varType =
|
|
97
|
+
var varType = _variable.type;
|
|
85
98
|
if (varType === 'Variable') {
|
|
86
|
-
if (!
|
|
99
|
+
if (!_variable.node.init) {
|
|
87
100
|
return false;
|
|
88
101
|
}
|
|
89
|
-
var varSource =
|
|
102
|
+
var varSource = _variable.node.init.type;
|
|
90
103
|
// Variables initialised by a call expression or object expression are ok
|
|
91
104
|
if (varSource === 'CallExpression' || varSource === 'ObjectExpression') {
|
|
92
105
|
return true;
|