@atlaskit/eslint-plugin-design-system 9.7.0 → 10.0.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.
Files changed (144) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +6 -5
  3. package/constellation/consistent-css-prop-usage/usage.mdx +44 -30
  4. package/constellation/ensure-design-token-usage/usage.mdx +12 -7
  5. package/constellation/ensure-design-token-usage-preview/usage.mdx +2 -1
  6. package/constellation/icon-label/usage.mdx +5 -3
  7. package/constellation/index/usage.mdx +4 -2
  8. package/constellation/no-banned-imports/usage.mdx +3 -1
  9. package/constellation/no-css-tagged-template-expression/usage.mdx +22 -17
  10. package/constellation/no-deprecated-apis/usage.mdx +33 -27
  11. package/constellation/no-deprecated-design-token-usage/usage.mdx +7 -4
  12. package/constellation/no-deprecated-imports/usage.mdx +31 -27
  13. package/constellation/no-direct-use-of-web-platform-drag-and-drop/usage.mdx +19 -10
  14. package/constellation/no-empty-styled-expression/usage.mdx +19 -14
  15. package/constellation/no-exported-css/usage.mdx +15 -10
  16. package/constellation/no-exported-keyframes/usage.mdx +15 -10
  17. package/constellation/no-html-anchor/usage.mdx +40 -0
  18. package/constellation/no-html-button/usage.mdx +52 -0
  19. package/constellation/no-invalid-css-map/usage.mdx +69 -58
  20. package/constellation/no-keyframes-tagged-template-expression/usage.mdx +24 -18
  21. package/constellation/no-margin/usage.mdx +3 -2
  22. package/constellation/no-nested-styles/usage.mdx +16 -16
  23. package/constellation/no-physical-properties/usage.mdx +13 -13
  24. package/constellation/no-styled-tagged-template-expression/usage.mdx +39 -34
  25. package/constellation/no-unsafe-design-token-usage/usage.mdx +8 -7
  26. package/constellation/no-unsafe-style-overrides/usage.mdx +10 -7
  27. package/constellation/no-unsupported-drag-and-drop-libraries/usage.mdx +8 -2
  28. package/constellation/prefer-primitives/usage.mdx +3 -2
  29. package/constellation/use-button-group-label/usage.mdx +4 -2
  30. package/constellation/use-drawer-label/usage.mdx +4 -2
  31. package/constellation/use-heading/usage.mdx +7 -4
  32. package/constellation/use-heading-level-in-spotlight-card/usage.mdx +3 -2
  33. package/constellation/use-href-in-link-item/usage.mdx +2 -1
  34. package/constellation/use-popup-label/usage.mdx +5 -2
  35. package/constellation/use-primitives/usage.mdx +40 -39
  36. package/constellation/use-primitives-text/usage.mdx +7 -3
  37. package/constellation/use-tokens-space/usage.mdx +7 -3
  38. package/constellation/use-tokens-typography/usage.mdx +15 -6
  39. package/constellation/use-visually-hidden/usage.mdx +2 -1
  40. package/dist/cjs/common/token-maps.partial.js +49 -0
  41. package/dist/cjs/index.codegen.js +1 -1
  42. package/dist/cjs/presets/all.codegen.js +3 -2
  43. package/dist/cjs/presets/recommended.codegen.js +1 -1
  44. package/dist/cjs/rules/index.codegen.js +5 -3
  45. package/dist/cjs/rules/no-html-anchor/index.js +39 -0
  46. package/dist/cjs/rules/no-html-anchor/node-types/index.js +19 -0
  47. package/dist/cjs/rules/no-html-anchor/node-types/jsx-element/index.js +28 -0
  48. package/dist/cjs/rules/no-html-anchor/node-types/styled-component/get-styled-component-call.js +47 -0
  49. package/dist/cjs/rules/no-html-anchor/node-types/styled-component/index.js +37 -0
  50. package/dist/cjs/rules/no-html-anchor/node-types/supported.js +66 -0
  51. package/dist/cjs/rules/no-html-anchor/utils/get-jsx-element-by-name.js +53 -0
  52. package/dist/cjs/rules/no-html-button/index.js +39 -0
  53. package/dist/cjs/rules/no-html-button/node-types/index.js +19 -0
  54. package/dist/cjs/rules/no-html-button/node-types/jsx-element/index.js +28 -0
  55. package/dist/cjs/rules/no-html-button/node-types/styled-component/get-styled-component-call.js +47 -0
  56. package/dist/cjs/rules/no-html-button/node-types/styled-component/index.js +37 -0
  57. package/dist/cjs/rules/no-html-button/node-types/supported.js +79 -0
  58. package/dist/cjs/rules/no-html-button/utils/get-jsx-element-by-name.js +53 -0
  59. package/dist/es2019/common/token-maps.partial.js +42 -0
  60. package/dist/es2019/index.codegen.js +1 -1
  61. package/dist/es2019/presets/all.codegen.js +3 -2
  62. package/dist/es2019/presets/recommended.codegen.js +1 -1
  63. package/dist/es2019/rules/index.codegen.js +5 -3
  64. package/dist/es2019/rules/no-html-anchor/index.js +33 -0
  65. package/dist/es2019/rules/no-html-anchor/node-types/index.js +2 -0
  66. package/dist/es2019/rules/no-html-anchor/node-types/jsx-element/index.js +20 -0
  67. package/dist/es2019/rules/no-html-anchor/node-types/styled-component/get-styled-component-call.js +42 -0
  68. package/dist/es2019/rules/no-html-anchor/node-types/styled-component/index.js +32 -0
  69. package/dist/es2019/rules/no-html-anchor/node-types/supported.js +56 -0
  70. package/dist/es2019/rules/no-html-anchor/utils/get-jsx-element-by-name.js +39 -0
  71. package/dist/es2019/rules/no-html-button/index.js +33 -0
  72. package/dist/es2019/rules/no-html-button/node-types/index.js +2 -0
  73. package/dist/es2019/rules/no-html-button/node-types/jsx-element/index.js +20 -0
  74. package/dist/es2019/rules/no-html-button/node-types/styled-component/get-styled-component-call.js +42 -0
  75. package/dist/es2019/rules/no-html-button/node-types/styled-component/index.js +32 -0
  76. package/dist/es2019/rules/no-html-button/node-types/supported.js +69 -0
  77. package/dist/es2019/rules/no-html-button/utils/get-jsx-element-by-name.js +39 -0
  78. package/dist/esm/common/token-maps.partial.js +42 -0
  79. package/dist/esm/index.codegen.js +1 -1
  80. package/dist/esm/presets/all.codegen.js +3 -2
  81. package/dist/esm/presets/recommended.codegen.js +1 -1
  82. package/dist/esm/rules/index.codegen.js +5 -3
  83. package/dist/esm/rules/no-html-anchor/index.js +33 -0
  84. package/dist/esm/rules/no-html-anchor/node-types/index.js +2 -0
  85. package/dist/esm/rules/no-html-anchor/node-types/jsx-element/index.js +19 -0
  86. package/dist/esm/rules/no-html-anchor/node-types/styled-component/get-styled-component-call.js +42 -0
  87. package/dist/esm/rules/no-html-anchor/node-types/styled-component/index.js +31 -0
  88. package/dist/esm/rules/no-html-anchor/node-types/supported.js +57 -0
  89. package/dist/esm/rules/no-html-anchor/utils/get-jsx-element-by-name.js +47 -0
  90. package/dist/esm/rules/no-html-button/index.js +33 -0
  91. package/dist/esm/rules/no-html-button/node-types/index.js +2 -0
  92. package/dist/esm/rules/no-html-button/node-types/jsx-element/index.js +19 -0
  93. package/dist/esm/rules/no-html-button/node-types/styled-component/get-styled-component-call.js +42 -0
  94. package/dist/esm/rules/no-html-button/node-types/styled-component/index.js +31 -0
  95. package/dist/esm/rules/no-html-button/node-types/supported.js +70 -0
  96. package/dist/esm/rules/no-html-button/utils/get-jsx-element-by-name.js +47 -0
  97. package/dist/types/common/token-maps.partial.d.ts +65 -0
  98. package/dist/types/index.codegen.d.ts +2 -1
  99. package/dist/types/presets/all.codegen.d.ts +3 -2
  100. package/dist/types/presets/recommended.codegen.d.ts +1 -1
  101. package/dist/types/rules/index.codegen.d.ts +2 -1
  102. package/dist/types/rules/no-html-anchor/index.d.ts +3 -0
  103. package/dist/types/rules/no-html-anchor/node-types/index.d.ts +2 -0
  104. package/dist/types/rules/no-html-anchor/node-types/jsx-element/index.d.ts +8 -0
  105. package/dist/types/rules/no-html-anchor/node-types/styled-component/get-styled-component-call.d.ts +6 -0
  106. package/dist/types/rules/no-html-anchor/node-types/styled-component/index.d.ts +8 -0
  107. package/dist/types/rules/no-html-anchor/node-types/supported.d.ts +7 -0
  108. package/dist/types/rules/no-html-anchor/utils/get-jsx-element-by-name.d.ts +6 -0
  109. package/dist/types/rules/no-html-button/index.d.ts +3 -0
  110. package/dist/types/rules/no-html-button/node-types/index.d.ts +2 -0
  111. package/dist/types/rules/no-html-button/node-types/jsx-element/index.d.ts +8 -0
  112. package/dist/types/rules/no-html-button/node-types/styled-component/get-styled-component-call.d.ts +6 -0
  113. package/dist/types/rules/no-html-button/node-types/styled-component/index.d.ts +8 -0
  114. package/dist/types/rules/no-html-button/node-types/supported.d.ts +7 -0
  115. package/dist/types/rules/no-html-button/utils/get-jsx-element-by-name.d.ts +6 -0
  116. package/dist/types-ts4.5/common/token-maps.partial.d.ts +65 -0
  117. package/dist/types-ts4.5/index.codegen.d.ts +2 -1
  118. package/dist/types-ts4.5/presets/all.codegen.d.ts +3 -2
  119. package/dist/types-ts4.5/presets/recommended.codegen.d.ts +1 -1
  120. package/dist/types-ts4.5/rules/index.codegen.d.ts +2 -1
  121. package/dist/types-ts4.5/rules/no-html-anchor/node-types/index.d.ts +2 -0
  122. package/dist/types-ts4.5/rules/no-html-anchor/node-types/jsx-element/index.d.ts +8 -0
  123. package/dist/types-ts4.5/rules/no-html-anchor/node-types/styled-component/get-styled-component-call.d.ts +6 -0
  124. package/dist/types-ts4.5/rules/no-html-anchor/node-types/styled-component/index.d.ts +8 -0
  125. package/dist/types-ts4.5/rules/no-html-anchor/node-types/supported.d.ts +7 -0
  126. package/dist/types-ts4.5/rules/no-html-anchor/utils/get-jsx-element-by-name.d.ts +6 -0
  127. package/dist/types-ts4.5/rules/no-html-button/node-types/index.d.ts +2 -0
  128. package/dist/types-ts4.5/rules/no-html-button/node-types/jsx-element/index.d.ts +8 -0
  129. package/dist/types-ts4.5/rules/no-html-button/node-types/styled-component/get-styled-component-call.d.ts +6 -0
  130. package/dist/types-ts4.5/rules/no-html-button/node-types/styled-component/index.d.ts +8 -0
  131. package/dist/types-ts4.5/rules/no-html-button/node-types/supported.d.ts +7 -0
  132. package/dist/types-ts4.5/rules/no-html-button/utils/get-jsx-element-by-name.d.ts +6 -0
  133. package/package.json +3 -2
  134. package/constellation/no-html-button-element/usage.mdx +0 -26
  135. package/dist/cjs/rules/no-html-button-element/index.js +0 -107
  136. package/dist/cjs/rules/no-html-button-element/utils.js +0 -18
  137. package/dist/es2019/rules/no-html-button-element/index.js +0 -101
  138. package/dist/es2019/rules/no-html-button-element/utils.js +0 -12
  139. package/dist/esm/rules/no-html-button-element/index.js +0 -101
  140. package/dist/esm/rules/no-html-button-element/utils.js +0 -12
  141. package/dist/types/rules/no-html-button-element/utils.d.ts +0 -2
  142. package/dist/types-ts4.5/rules/no-html-button-element/utils.d.ts +0 -2
  143. /package/dist/types-ts4.5/rules/{no-html-button-element → no-html-anchor}/index.d.ts +0 -0
  144. /package/dist/{types/rules/no-html-button-element → types-ts4.5/rules/no-html-button}/index.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/eslint-plugin-design-system
2
2
 
3
+ ## 10.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#96329](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/96329)
8
+ [`16e879f9ab10`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/16e879f9ab10) -
9
+ Renamed the `no-html-button-element` rule to `no-html-button`. This rule is not yet in use, so
10
+ it should not be a breaking change. The new name reflects the broadened scope of the rule to not
11
+ only include `<button>` elements, but other forms of HTML buttons such as
12
+ `<input type="button" />` and `role="button"`.
13
+
14
+ ### Minor Changes
15
+
16
+ - [#97630](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/97630)
17
+ [`8cac5287d0c4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8cac5287d0c4) -
18
+ Adding new rule: `no-html-anchor`. This discourages usage of native HTML anchors and favors ADS
19
+ link components.
20
+
3
21
  ## 9.7.0
4
22
 
5
23
  ### Minor Changes
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Design System ESLint Plugin
2
2
 
3
- This plugin contains rules that should be used when working with the [Atlassian Design System](https://atlassian.design).
3
+ This plugin contains rules that should be used when working with the
4
+ [Atlassian Design System](https://atlassian.design).
4
5
 
5
6
  ## Installation
6
7
 
@@ -20,9 +21,8 @@ module.exports = {
20
21
  };
21
22
  ```
22
23
 
23
- We don't recommended maintaining your own configuration.
24
- If you do not use our config you will need to specify individual rules and configuration.
25
- Add the plugin to your `.eslintrc.js` file.
24
+ We don't recommended maintaining your own configuration. If you do not use our config you will need
25
+ to specify individual rules and configuration. Add the plugin to your `.eslintrc.js` file.
26
26
 
27
27
  ```diff
28
28
  module.exports = {
@@ -62,7 +62,8 @@ module.exports = {
62
62
  | <a href="./src/rules/no-empty-styled-expression/README.md">no-empty-styled-expression</a> | Forbids any styled expression to be used when passing empty arguments to styled.div() (or other JSX elements). | Yes | | |
63
63
  | <a href="./src/rules/no-exported-css/README.md">no-exported-css</a> | Forbid exporting `css` function calls. Exporting `css` function calls can result in unexpected behaviour at runtime, and is not statically analysable. | Yes | | |
64
64
  | <a href="./src/rules/no-exported-keyframes/README.md">no-exported-keyframes</a> | Forbid exporting `keyframes` function calls. Exporting `css` function calls can result in unexpected behaviour at runtime, and is not statically analysable. | Yes | | |
65
- | <a href="./src/rules/no-html-button-element/README.md">no-html-button-element</a> | Prevent direct usage of HTML button elements and enforce usage of Button and Pressable. | | | |
65
+ | <a href="./src/rules/no-html-anchor/README.md">no-html-anchor</a> | Discourage direct usage of HTML anchor elements in favor of Atlassian Design System link components. | | | |
66
+ | <a href="./src/rules/no-html-button/README.md">no-html-button</a> | Discourage direct usage of HTML button elements in favor of Atlassian Design System button components. | | | |
66
67
  | <a href="./src/rules/no-invalid-css-map/README.md">no-invalid-css-map</a> | Checks the validity of a CSS map created through cssMap. This is intended to be used alongside TypeScript's type-checking. | Yes | | |
67
68
  | <a href="./src/rules/no-keyframes-tagged-template-expression/README.md">no-keyframes-tagged-template-expression</a> | Disallows any `keyframe` tagged template expressions that originate from Emotion, Styled Components or Compiled | | Yes | |
68
69
  | <a href="./src/rules/no-margin/README.md">no-margin</a> | Disallow using the margin CSS property. | | | |
@@ -4,22 +4,26 @@ Ensures consistency with css prop usage.
4
4
 
5
5
  ## Rationale
6
6
 
7
- Every product should be defining styles in the same way, using the same tools, enforced by the same linting rules, which we can then all evolve and scale together.
7
+ Every product should be defining styles in the same way, using the same tools, enforced by the same
8
+ linting rules, which we can then all evolve and scale together.
8
9
 
9
10
  ## How the rule works
10
11
 
11
12
  This rule checks for the following cases:
12
13
 
13
- - Styles should not be defined inline; it should instead be in a standalone variable.
14
- - The exception for this is style composition (e.g. `<div css={[baseStyles, moreStyles]} />`), which is a way to combine styles from two variables.
15
- - Styles must be wrapped in a `css` function call.
16
- - Styles must be defined in the same file as their usage, and not be imported.
17
- - Styles should not contain spread operators (e.g. `css({ ...spreadStyles })`).
18
- - Styles must all be defined at the top of the file, or at the bottom of the file.
14
+ - Styles should not be defined inline; it should instead be in a standalone variable.
15
+ - The exception for this is style composition (e.g. `<div css={[baseStyles, moreStyles]} />`),
16
+ which is a way to combine styles from two variables.
17
+ - Styles must be wrapped in a `css` function call.
18
+ - Styles must be defined in the same file as their usage, and not be imported.
19
+ - Styles should not contain spread operators (e.g. `css({ ...spreadStyles })`).
20
+ - Styles must all be defined at the top of the file, or at the bottom of the file.
19
21
 
20
- This rule also has an autofixer that enforces and fixes the code (where practical) to meet the above requirements.
22
+ This rule also has an autofixer that enforces and fixes the code (where practical) to meet the above
23
+ requirements.
21
24
 
22
- All the above can also work for custom `css` functions, such as `xcss` (https://atlassian.design/components/primitives/xcss/).
25
+ All the above can also work for custom `css` functions, such as `xcss`
26
+ (https://atlassian.design/components/primitives/xcss/).
23
27
 
24
28
  This rule has several options - see below.
25
29
 
@@ -80,20 +84,21 @@ function Button({ children }) {
80
84
 
81
85
  ### Correct
82
86
 
83
- **Using the css() function to create a style object and passing it as a variable into the css={...} JSX attribute.**
87
+ **Using the css() function to create a style object and passing it as a variable into the css={...}
88
+ JSX attribute.**
84
89
 
85
90
  With the following options turned on:
86
91
 
87
- - cssFunctions = ['css']
88
- - stylesPlacement = 'top'
92
+ - cssFunctions = ['css']
93
+ - stylesPlacement = 'top'
89
94
 
90
95
  ```js
91
96
  const containerStyles = css({
92
- zIndex: 1,
97
+ zIndex: 1,
93
98
  });
94
99
 
95
100
  function Button({ children }) {
96
- return <button css={containerStyles}>{children}</button>;
101
+ return <button css={containerStyles}>{children}</button>;
97
102
  }
98
103
  ```
99
104
 
@@ -101,8 +106,8 @@ function Button({ children }) {
101
106
 
102
107
  With the following options turned on:
103
108
 
104
- - cssFunctions = ['css']
105
- - stylesPlacement = 'top'
109
+ - cssFunctions = ['css']
110
+ - stylesPlacement = 'top'
106
111
 
107
112
  ```js
108
113
  const borderStyles = cssMap({
@@ -119,22 +124,20 @@ function Button({ children }) {
119
124
 
120
125
  With the following options turned on:
121
126
 
122
- - cssFunctions = ['css']
123
- - stylesPlacement = 'bottom'
127
+ - cssFunctions = ['css']
128
+ - stylesPlacement = 'bottom'
124
129
 
125
130
  ```js
126
131
  function Button({ children }) {
127
- return (
128
- <button css={[baseContainerStyles, containerStyles]}>{children}</button>
129
- );
132
+ return <button css={[baseContainerStyles, containerStyles]}>{children}</button>;
130
133
  }
131
134
 
132
135
  const baseContainerStyles = css({
133
- zIndex: 5,
136
+ zIndex: 5,
134
137
  });
135
138
 
136
139
  const containerStyles = css({
137
- zIndex: 7,
140
+ zIndex: 7,
138
141
  });
139
142
  ```
140
143
 
@@ -153,35 +156,46 @@ This rule comes with options to support different repository configurations.
153
156
 
154
157
  ### cssFunctions
155
158
 
156
- An array of function names the linting rule should target. Defaults to `['css', 'xcss']`. The functionality of `cssMap` will be linted regardless of the configuration of `cssFunctions`, as it can be used with either attribute.
159
+ An array of function names the linting rule should target. Defaults to `['css', 'xcss']`. The
160
+ functionality of `cssMap` will be linted regardless of the configuration of `cssFunctions`, as it
161
+ can be used with either attribute.
157
162
 
158
163
  ### stylesPlacement
159
164
 
160
165
  Either `top` or `bottom`.
161
166
 
162
- The rule prevents inline styles from being created. This option defines what the error message should say: "(...) styles at the top (...)" or "(...) styles at the bottom (...)".
163
- Defaults to `top`.
167
+ The rule prevents inline styles from being created. This option defines what the error message
168
+ should say: "(...) styles at the top (...)" or "(...) styles at the bottom (...)". Defaults to
169
+ `top`.
164
170
 
165
171
  ### cssImportSource
166
172
 
167
- When auto-fixing the contents of the `css` attribute, this rule will wrap CSS styles in a `css(...)` function call or `` css`...` `` template expression, and it will add an import declaration for the `css` function. `cssImportSource` is a string that determines what package `css` should be imported from.
173
+ When auto-fixing the contents of the `css` attribute, this rule will wrap CSS styles in a `css(...)`
174
+ function call or ``css`...` `` template expression, and it will add an import declaration for the
175
+ `css` function. `cssImportSource` is a string that determines what package `css` should be imported
176
+ from.
168
177
 
169
178
  This is `@compiled/react` by default.
170
179
 
171
180
  ### xcssImportSource
172
181
 
173
- When auto-fixing the contents of the `xcss` attribute, this rule will wrap XCSS styles in a `xcss(...)` function call, and it will add an import declaration for the `xcss` function. `xcssImportSource` is a string that determines what package `xcss` should be imported from.
182
+ When auto-fixing the contents of the `xcss` attribute, this rule will wrap XCSS styles in a
183
+ `xcss(...)` function call, and it will add an import declaration for the `xcss` function.
184
+ `xcssImportSource` is a string that determines what package `xcss` should be imported from.
174
185
 
175
186
  This is `@atlaskit/primitives` by default.
176
187
 
177
188
  ### excludeReactComponents
178
189
 
179
- Whether to exclude `css` attributes of React components from being affected by this ESLint rule. We assume that an element is a React component if its name starts with a capital letter, e.g. `<Button />`.
190
+ Whether to exclude `css` attributes of React components from being affected by this ESLint rule. We
191
+ assume that an element is a React component if its name starts with a capital letter, e.g.
192
+ `<Button />`.
180
193
 
181
194
  This is `false` by default.
182
195
 
183
196
  ### autoFix
184
197
 
185
- When set to `true`, this rule will turn on the autofixer. Set this to `false` if you do not want the autofixers to run.
198
+ When set to `true`, this rule will turn on the autofixer. Set this to `false` if you do not want the
199
+ autofixers to run.
186
200
 
187
201
  This is `true` by default.
@@ -1,12 +1,14 @@
1
1
  # ensure-design-token-usage
2
2
 
3
- Using design tokens results in a harmonious experience for end users whilst providing theming and consistency.
4
- All experiences must use color tokens otherwise when switching between themes, unexpected incidents can occur where not all of the UI is themed.
5
- Space, and shape tokens are strongly recommended to further align our experiences and make future changes easier.
3
+ Using design tokens results in a harmonious experience for end users whilst providing theming and
4
+ consistency. All experiences must use color tokens otherwise when switching between themes,
5
+ unexpected incidents can occur where not all of the UI is themed. Space, and shape tokens are
6
+ strongly recommended to further align our experiences and make future changes easier.
6
7
 
7
8
  ## Examples
8
9
 
9
- Using anything other than design tokens such as hardcoded values or legacy theme colors will be considered violations.
10
+ Using anything other than design tokens such as hardcoded values or legacy theme colors will be
11
+ considered violations.
10
12
 
11
13
  ### Incorrect
12
14
 
@@ -57,15 +59,18 @@ This rule comes with options to aid in migrating to design tokens.
57
59
 
58
60
  ### domains
59
61
 
60
- An array specifiying which token domains to lint against (`color`, `spacing`, `shape`). Defaults to [`'color'`] if not provided.
62
+ An array specifiying which token domains to lint against (`color`, `spacing`, `shape`). Defaults to
63
+ [`'color'`] if not provided.
61
64
 
62
65
  ### applyImport
63
66
 
64
- When `true`, the rule when automatically add imports to the `@atlaskit/tokens` package where tokens are auto-fixed. Defaults to `true` if not provided.
67
+ When `true`, the rule when automatically add imports to the `@atlaskit/tokens` package where tokens
68
+ are auto-fixed. Defaults to `true` if not provided.
65
69
 
66
70
  ### shouldEnforceFallbacks
67
71
 
68
- When `true` the rule will add in stub fallbacks when choosing a suggestion in your IDE. Defaults to `false` if not provided.
72
+ When `true` the rule will add in stub fallbacks when choosing a suggestion in your IDE. Defaults to
73
+ `false` if not provided.
69
74
 
70
75
  ### exceptions
71
76
 
@@ -1,5 +1,6 @@
1
1
  # ensure-design-token-usage/preview
2
2
 
3
- This rule is a clone of `ensure-design-token-usage` and is intended to allow you to set some domains to `warn` before they are set to `error` in the main rule.
3
+ This rule is a clone of `ensure-design-token-usage` and is intended to allow you to set some domains
4
+ to `warn` before they are set to `error` in the main rule.
4
5
 
5
6
  See `ensure-design-token-usage` for full usage documentation.
@@ -1,11 +1,13 @@
1
1
  # icon-label
2
2
 
3
- Icon labels are used to describe what the icon is so the visually impaired can be described what the UI element is.
4
- There are cases where icons should have labels as well as cases where they shouldn't be labelled.
3
+ Icon labels are used to describe what the icon is so the visually impaired can be described what the
4
+ UI element is. There are cases where icons should have labels as well as cases where they shouldn't
5
+ be labelled.
5
6
 
6
7
  ## Examples
7
8
 
8
- This rule will find violations for when an icon label is or isn't needed when composed with other Design System components.
9
+ This rule will find violations for when an icon label is or isn't needed when composed with other
10
+ Design System components.
9
11
 
10
12
  ### Incorrect
11
13
 
@@ -2,7 +2,8 @@
2
2
  order: 0
3
3
  ---
4
4
 
5
- This plugin contains rules that should be used when working with the [Atlassian Design System](https://atlassian.design).
5
+ This plugin contains rules that should be used when working with the
6
+ [Atlassian Design System](https://atlassian.design).
6
7
 
7
8
  ## Rules
8
9
 
@@ -24,7 +25,8 @@ This plugin contains rules that should be used when working with the [Atlassian
24
25
  | <a href="no-empty-styled-expression/usage">no-empty-styled-expression</a> | Forbids any styled expression to be used when passing empty arguments to styled.div() (or other JSX elements). | Yes | | |
25
26
  | <a href="no-exported-css/usage">no-exported-css</a> | Forbid exporting `css` function calls. Exporting `css` function calls can result in unexpected behaviour at runtime, and is not statically analysable. | Yes | | |
26
27
  | <a href="no-exported-keyframes/usage">no-exported-keyframes</a> | Forbid exporting `keyframes` function calls. Exporting `css` function calls can result in unexpected behaviour at runtime, and is not statically analysable. | Yes | | |
27
- | <a href="no-html-button-element/usage">no-html-button-element</a> | Prevent direct usage of HTML button elements and enforce usage of Button and Pressable. | | | |
28
+ | <a href="no-html-anchor/usage">no-html-anchor</a> | Discourage direct usage of HTML anchor elements in favor of Atlassian Design System link components. | | | |
29
+ | <a href="no-html-button/usage">no-html-button</a> | Discourage direct usage of HTML button elements in favor of Atlassian Design System button components. | | | |
28
30
  | <a href="no-invalid-css-map/usage">no-invalid-css-map</a> | Checks the validity of a CSS map created through cssMap. This is intended to be used alongside TypeScript's type-checking. | Yes | | |
29
31
  | <a href="no-keyframes-tagged-template-expression/usage">no-keyframes-tagged-template-expression</a> | Disallows any `keyframe` tagged template expressions that originate from Emotion, Styled Components or Compiled | | Yes | |
30
32
  | <a href="no-margin/usage">no-margin</a> | Disallow using the margin CSS property. | | | |
@@ -1,6 +1,8 @@
1
1
  # no-banned-imports
2
2
 
3
- Using private or experimental packages is dangerous as they are not supported across major versions meaning you will not be able to migrate easily causing friction for yourself and the Atlassian Design System team.
3
+ Using private or experimental packages is dangerous as they are not supported across major versions
4
+ meaning you will not be able to migrate easily causing friction for yourself and the Atlassian
5
+ Design System team.
4
6
 
5
7
  ## Examples
6
8
 
@@ -1,10 +1,14 @@
1
1
  # no-css-tagged-template-expression
2
2
 
3
- Disallows any `css` tagged template expressions that originate from a CSS-in-JS library, including `@atlaskit/css`, `@compiled/react`, Emotion, and `styled-components`.
3
+ Disallows any `css` tagged template expressions that originate from a CSS-in-JS library, including
4
+ `@atlaskit/css`, `@compiled/react`, Emotion, and `styled-components`.
4
5
 
5
- Tagged template expressions cannot be type safe and are difficult to parse correctly. Will auto fix ` css`` ` to the preferred `css({})` call expression syntax.
6
+ Tagged template expressions cannot be type safe and are difficult to parse correctly. Will auto fix
7
+ ` css`` ` to the preferred `css({})` call expression syntax.
6
8
 
7
- Thank you to the [Compiled team for their rule](https://github.com/atlassian-labs/compiled/tree/master/packages/eslint-plugin/src/rules/no-css-tagged-template-expression) from which this was ported.
9
+ Thank you to the
10
+ [Compiled team for their rule](https://github.com/atlassian-labs/compiled/tree/master/packages/eslint-plugin/src/rules/no-css-tagged-template-expression)
11
+ from which this was ported.
8
12
 
9
13
  ## Examples
10
14
 
@@ -14,12 +18,12 @@ Thank you to the [Compiled team for their rule](https://github.com/atlassian-lab
14
18
  import { css } from '@emotion/react';
15
19
 
16
20
  css`
17
- color: blue;
21
+ color: blue;
18
22
  `;
19
23
 
20
24
  const styles = css`
21
- color: blue;
22
- font-weight: 500;
25
+ color: blue;
26
+ font-weight: 500;
23
27
  `;
24
28
  ```
25
29
 
@@ -31,8 +35,8 @@ import { css } from '@emotion/react';
31
35
  css({ color: 'blue' });
32
36
 
33
37
  const styles = css({
34
- color: 'blue',
35
- fontWeight: 500,
38
+ color: 'blue',
39
+ fontWeight: 500,
36
40
  });
37
41
  ```
38
42
 
@@ -42,15 +46,16 @@ const styles = css({
42
46
 
43
47
  By default, this rule will check `css` usages from:
44
48
 
45
- - `@atlaskit/css`
46
- - `@atlaskit/primitives`
47
- - `@compiled/react`
48
- - `@emotion/react`
49
- - `@emotion/core`
50
- - `@emotion/styled`
51
- - `styled-components`
49
+ - `@atlaskit/css`
50
+ - `@atlaskit/primitives`
51
+ - `@compiled/react`
52
+ - `@emotion/react`
53
+ - `@emotion/core`
54
+ - `@emotion/styled`
55
+ - `styled-components`
52
56
 
53
- To change this list of libraries, you can define a custom set of `importSources`, which accepts an array of package names (strings).
57
+ To change this list of libraries, you can define a custom set of `importSources`, which accepts an
58
+ array of package names (strings).
54
59
 
55
60
  ```tsx
56
61
  // [{ importSources: ['other-lib'] }]
@@ -63,4 +68,4 @@ export const styles = css``;
63
68
 
64
69
  ## Limitations
65
70
 
66
- - Comments are not auto-fixable. You will need to manually convert usages containing functions.
71
+ - Comments are not auto-fixable. You will need to manually convert usages containing functions.
@@ -1,10 +1,12 @@
1
1
  # no-deprecated-apis
2
2
 
3
- Props across the Atlassian Design System can be deprecated when they are deemed no-longer fit for purporse or dangerous and risk effective use at scale.
3
+ Props across the Atlassian Design System can be deprecated when they are deemed no-longer fit for
4
+ purporse or dangerous and risk effective use at scale.
4
5
 
5
6
  ## Examples
6
7
 
7
- Anything that can be used as props from Atlassian Design System components can be violations when marked as deprecated.
8
+ Anything that can be used as props from Atlassian Design System components can be violations when
9
+ marked as deprecated.
8
10
 
9
11
  ### Incorrect
10
12
 
@@ -18,26 +20,28 @@ Anything that can be used as props from Atlassian Design System components can b
18
20
 
19
21
  ## Options
20
22
 
21
- The rule can take one option: `deprecatedConfig`,
22
- if not provided the rule will use an internal config.
23
- If provided the rule will use the passed in config instead.
23
+ The rule can take one option: `deprecatedConfig`, if not provided the rule will use an internal
24
+ config. If provided the rule will use the passed in config instead.
24
25
 
25
26
  ### deprecatedConfig
26
27
 
27
28
  The following fields can be defined in the config:
28
29
 
29
- - `deprecatedProp`, which is the deprecated props. Each prop has the following fields:
30
- - `moduleSpecifier`, which is the module specifier of the package in which the prop was deprecated. For example: `@atlaskit/button`.
31
- - `namedSpecifier` **(optional)**, which is an array of named specifiers of the package in which the prop was deprecated. For example: `Button`.
32
- - `actionableVersion` **(optional)**, which is the version of the package in which the prop can be actioned on. For example: `1.0.0`.
30
+ - `deprecatedProp`, which is the deprecated props. Each prop has the following fields:
31
+ - `moduleSpecifier`, which is the module specifier of the package in which the prop was
32
+ deprecated. For example: `@atlaskit/button`.
33
+ - `namedSpecifier` **(optional)**, which is an array of named specifiers of the package in
34
+ which the prop was deprecated. For example: `Button`.
35
+ - `actionableVersion` **(optional)**, which is the version of the package in which the prop
36
+ can be actioned on. For example: `1.0.0`.
33
37
 
34
38
  ```json
35
39
  {
36
- "cssFn": [
37
- {
38
- "moduleSpecifier": "@atlaskit/menu"
39
- }
40
- ]
40
+ "cssFn": [
41
+ {
42
+ "moduleSpecifier": "@atlaskit/menu"
43
+ }
44
+ ]
41
45
  }
42
46
  ```
43
47
 
@@ -45,24 +49,26 @@ The following fields can be defined in the config:
45
49
  import { configs } from '@atlaskit/eslint-plugin-design-system';
46
50
 
47
51
  module.exports = {
48
- rules: {
49
- '@atlaskit/design-system/no-deprecated-api': [
50
- 'error',
51
- {
52
- deprecatedConfig: {
53
- cssFn: [
52
+ rules: {
53
+ '@atlaskit/design-system/no-deprecated-api': [
54
+ 'error',
54
55
  {
55
- moduleSpecifier: '@atlaskit/menu',
56
+ deprecatedConfig: {
57
+ cssFn: [
58
+ {
59
+ moduleSpecifier: '@atlaskit/menu',
60
+ },
61
+ ],
62
+ },
56
63
  },
57
- ],
58
- },
59
- },
60
- ],
61
- },
64
+ ],
65
+ },
62
66
  };
63
67
  ```
64
68
 
65
- The plugin also provides a `filterActionableDeprecations` util function that accepts the `deprecated APIs config` and your root `package.json` as params and will filter the default deprecated APIs config based on the package versions installed.
69
+ The plugin also provides a `filterActionableDeprecations` util function that accepts the
70
+ `deprecated APIs config` and your root `package.json` as params and will filter the default
71
+ deprecated APIs config based on the package versions installed.
66
72
 
67
73
  ```js
68
74
  import { configs, filterActionableDeprecations } from '@atlaskit/eslint-plugin-design-system';
@@ -1,7 +1,7 @@
1
1
  # no-deprecated-design-token-usage
2
2
 
3
- Using deprecated design tokens is dangerous as they will eventually be deleted after the sunset period.
4
- This rule helps you move to non-deprecated design tokens.
3
+ Using deprecated design tokens is dangerous as they will eventually be deleted after the sunset
4
+ period. This rule helps you move to non-deprecated design tokens.
5
5
 
6
6
  ## Examples
7
7
 
@@ -20,8 +20,11 @@ css({ color: token('i.am.a.token') });
20
20
 
21
21
  ## Options
22
22
 
23
- It's recommended to set this rule to "warn" to allow for new and old tokens to exist side-by-side for the duration of the deprecation period and avoid big-bang migrations.
23
+ It's recommended to set this rule to "warn" to allow for new and old tokens to exist side-by-side
24
+ for the duration of the deprecation period and avoid big-bang migrations.
24
25
 
25
- Once the deprecation period is over for a design token it will be moved into `deleted` state at which point the counterpart of this rule `no-unsafe-design-token-usage` will mark violations as errors.
26
+ Once the deprecation period is over for a design token it will be moved into `deleted` state at
27
+ which point the counterpart of this rule `no-unsafe-design-token-usage` will mark violations as
28
+ errors.
26
29
 
27
30
  Running `eslint --fix` will automatically apply replacement tokens if present.
@@ -1,6 +1,7 @@
1
1
  # no-deprecated-imports
2
2
 
3
- Packages across the Atlassian Design System can be deprecated when they are deemed no-longer fit for purporse or dangerous and risk effective use at scale.
3
+ Packages across the Atlassian Design System can be deprecated when they are deemed no-longer fit for
4
+ purporse or dangerous and risk effective use at scale.
4
5
 
5
6
  ## Examples
6
7
 
@@ -17,27 +18,30 @@ import GlobalNav from '@atlaskit/global-navigation';
17
18
 
18
19
  ## Options
19
20
 
20
- The rule can take one option: `deprecatedConfig`,
21
- if not provided the rule will use an internal config.
22
- If provided the rule will use the passed in config instead.
21
+ The rule can take one option: `deprecatedConfig`, if not provided the rule will use an internal
22
+ config. If provided the rule will use the passed in config instead.
23
23
 
24
24
  ### deprecatedConfig
25
25
 
26
26
  The following fields can be defined in the config:
27
27
 
28
- - `packagePath`, which is the name of the package. For example: `@atlaskit/navigation-next` and `@atlaskit/navigation`.
29
- With the package path as the key, you can either provide the values as:
30
- - `message` **(optional)**, the message to display when the deprecated packages path is used. For example: `multi-select is deprecated. Please use '@atlaskit/select' instead.`
31
- Or as:
32
- - `imports`, which is an array of named imports to be deprecated. Each named import has the following fields:
33
- - `importName`, which is the name of the import to be deprecated. For example: `assistive` and `visuallyHidden`.
34
- - `message` **(optional)**, which is the message to display when the deprecated import is used. For example: `The assistive mixin is deprecated. Please use `@atlaskit/visually-hidden` instead.`.
28
+ - `packagePath`, which is the name of the package. For example: `@atlaskit/navigation-next` and
29
+ `@atlaskit/navigation`. With the package path as the key, you can either provide the values as:
30
+ - `message` **(optional)**, the message to display when the deprecated packages path is used.
31
+ For example: `multi-select is deprecated. Please use '@atlaskit/select' instead.` Or as:
32
+ - `imports`, which is an array of named imports to be deprecated. Each named import has the
33
+ following fields:
34
+ - `importName`, which is the name of the import to be deprecated. For example: `assistive`
35
+ and `visuallyHidden`.
36
+ - `message` **(optional)**, which is the message to display when the deprecated import is
37
+ used. For example:
38
+ `The assistive mixin is deprecated. Please use `@atlaskit/visually-hidden` instead.`.
35
39
 
36
40
  ```json
37
41
  {
38
- "@atlaskit/navigation-next": {
39
- "message": "navigation-next is deprecated. Please use '@atlaskit/atlassian-navigation' instead."
40
- }
42
+ "@atlaskit/navigation-next": {
43
+ "message": "navigation-next is deprecated. Please use '@atlaskit/atlassian-navigation' instead."
44
+ }
41
45
  }
42
46
  ```
43
47
 
@@ -45,18 +49,18 @@ The following fields can be defined in the config:
45
49
  import packageJson from './package.json';
46
50
 
47
51
  module.exports = {
48
- rules: {
49
- '@atlaskit/design-system/no-deprecated-imports': [
50
- 'error',
51
- {
52
- deprecatedConfig: {
53
- '@atlaskit/navigation-next': {
54
- message:
55
- "navigation-next is deprecated. Please use '@atlaskit/atlassian-navigation' instead.",
56
- },
57
- },
58
- },
59
- ],
60
- },
52
+ rules: {
53
+ '@atlaskit/design-system/no-deprecated-imports': [
54
+ 'error',
55
+ {
56
+ deprecatedConfig: {
57
+ '@atlaskit/navigation-next': {
58
+ message:
59
+ "navigation-next is deprecated. Please use '@atlaskit/atlassian-navigation' instead.",
60
+ },
61
+ },
62
+ },
63
+ ],
64
+ },
61
65
  };
62
66
  ```