@atlaskit/eslint-plugin-design-system 9.6.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 (151) hide show
  1. package/CHANGELOG.md +1004 -411
  2. package/README.md +7 -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 +5 -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 +56 -0
  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 +4 -2
  43. package/dist/cjs/presets/recommended.codegen.js +2 -1
  44. package/dist/cjs/rules/index.codegen.js +7 -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/cjs/rules/use-popup-label/index.js +90 -0
  60. package/dist/es2019/common/token-maps.partial.js +42 -0
  61. package/dist/es2019/index.codegen.js +1 -1
  62. package/dist/es2019/presets/all.codegen.js +4 -2
  63. package/dist/es2019/presets/recommended.codegen.js +2 -1
  64. package/dist/es2019/rules/index.codegen.js +7 -3
  65. package/dist/es2019/rules/no-html-anchor/index.js +33 -0
  66. package/dist/es2019/rules/no-html-anchor/node-types/index.js +2 -0
  67. package/dist/es2019/rules/no-html-anchor/node-types/jsx-element/index.js +20 -0
  68. package/dist/es2019/rules/no-html-anchor/node-types/styled-component/get-styled-component-call.js +42 -0
  69. package/dist/es2019/rules/no-html-anchor/node-types/styled-component/index.js +32 -0
  70. package/dist/es2019/rules/no-html-anchor/node-types/supported.js +56 -0
  71. package/dist/es2019/rules/no-html-anchor/utils/get-jsx-element-by-name.js +39 -0
  72. package/dist/es2019/rules/no-html-button/index.js +33 -0
  73. package/dist/es2019/rules/no-html-button/node-types/index.js +2 -0
  74. package/dist/es2019/rules/no-html-button/node-types/jsx-element/index.js +20 -0
  75. package/dist/es2019/rules/no-html-button/node-types/styled-component/get-styled-component-call.js +42 -0
  76. package/dist/es2019/rules/no-html-button/node-types/styled-component/index.js +32 -0
  77. package/dist/es2019/rules/no-html-button/node-types/supported.js +69 -0
  78. package/dist/es2019/rules/no-html-button/utils/get-jsx-element-by-name.js +39 -0
  79. package/dist/es2019/rules/use-popup-label/index.js +80 -0
  80. package/dist/esm/common/token-maps.partial.js +42 -0
  81. package/dist/esm/index.codegen.js +1 -1
  82. package/dist/esm/presets/all.codegen.js +4 -2
  83. package/dist/esm/presets/recommended.codegen.js +2 -1
  84. package/dist/esm/rules/index.codegen.js +7 -3
  85. package/dist/esm/rules/no-html-anchor/index.js +33 -0
  86. package/dist/esm/rules/no-html-anchor/node-types/index.js +2 -0
  87. package/dist/esm/rules/no-html-anchor/node-types/jsx-element/index.js +19 -0
  88. package/dist/esm/rules/no-html-anchor/node-types/styled-component/get-styled-component-call.js +42 -0
  89. package/dist/esm/rules/no-html-anchor/node-types/styled-component/index.js +31 -0
  90. package/dist/esm/rules/no-html-anchor/node-types/supported.js +57 -0
  91. package/dist/esm/rules/no-html-anchor/utils/get-jsx-element-by-name.js +47 -0
  92. package/dist/esm/rules/no-html-button/index.js +33 -0
  93. package/dist/esm/rules/no-html-button/node-types/index.js +2 -0
  94. package/dist/esm/rules/no-html-button/node-types/jsx-element/index.js +19 -0
  95. package/dist/esm/rules/no-html-button/node-types/styled-component/get-styled-component-call.js +42 -0
  96. package/dist/esm/rules/no-html-button/node-types/styled-component/index.js +31 -0
  97. package/dist/esm/rules/no-html-button/node-types/supported.js +70 -0
  98. package/dist/esm/rules/no-html-button/utils/get-jsx-element-by-name.js +47 -0
  99. package/dist/esm/rules/use-popup-label/index.js +84 -0
  100. package/dist/types/common/token-maps.partial.d.ts +65 -0
  101. package/dist/types/index.codegen.d.ts +4 -1
  102. package/dist/types/presets/all.codegen.d.ts +4 -2
  103. package/dist/types/presets/recommended.codegen.d.ts +2 -1
  104. package/dist/types/rules/index.codegen.d.ts +3 -1
  105. package/dist/types/rules/no-html-anchor/index.d.ts +3 -0
  106. package/dist/types/rules/no-html-anchor/node-types/index.d.ts +2 -0
  107. package/dist/types/rules/no-html-anchor/node-types/jsx-element/index.d.ts +8 -0
  108. package/dist/types/rules/no-html-anchor/node-types/styled-component/get-styled-component-call.d.ts +6 -0
  109. package/dist/types/rules/no-html-anchor/node-types/styled-component/index.d.ts +8 -0
  110. package/dist/types/rules/no-html-anchor/node-types/supported.d.ts +7 -0
  111. package/dist/types/rules/no-html-anchor/utils/get-jsx-element-by-name.d.ts +6 -0
  112. package/dist/types/rules/no-html-button/index.d.ts +3 -0
  113. package/dist/types/rules/no-html-button/node-types/index.d.ts +2 -0
  114. package/dist/types/rules/no-html-button/node-types/jsx-element/index.d.ts +8 -0
  115. package/dist/types/rules/no-html-button/node-types/styled-component/get-styled-component-call.d.ts +6 -0
  116. package/dist/types/rules/no-html-button/node-types/styled-component/index.d.ts +8 -0
  117. package/dist/types/rules/no-html-button/node-types/supported.d.ts +7 -0
  118. package/dist/types/rules/no-html-button/utils/get-jsx-element-by-name.d.ts +6 -0
  119. package/dist/types/rules/use-popup-label/index.d.ts +3 -0
  120. package/dist/types/rules/use-tokens-typography/utils.d.ts +0 -33
  121. package/dist/types-ts4.5/common/token-maps.partial.d.ts +65 -0
  122. package/dist/types-ts4.5/index.codegen.d.ts +4 -1
  123. package/dist/types-ts4.5/presets/all.codegen.d.ts +4 -2
  124. package/dist/types-ts4.5/presets/recommended.codegen.d.ts +2 -1
  125. package/dist/types-ts4.5/rules/index.codegen.d.ts +3 -1
  126. package/dist/types-ts4.5/rules/no-html-anchor/node-types/index.d.ts +2 -0
  127. package/dist/types-ts4.5/rules/no-html-anchor/node-types/jsx-element/index.d.ts +8 -0
  128. package/dist/types-ts4.5/rules/no-html-anchor/node-types/styled-component/get-styled-component-call.d.ts +6 -0
  129. package/dist/types-ts4.5/rules/no-html-anchor/node-types/styled-component/index.d.ts +8 -0
  130. package/dist/types-ts4.5/rules/no-html-anchor/node-types/supported.d.ts +7 -0
  131. package/dist/types-ts4.5/rules/no-html-anchor/utils/get-jsx-element-by-name.d.ts +6 -0
  132. package/dist/types-ts4.5/rules/no-html-button/node-types/index.d.ts +2 -0
  133. package/dist/types-ts4.5/rules/no-html-button/node-types/jsx-element/index.d.ts +8 -0
  134. package/dist/types-ts4.5/rules/no-html-button/node-types/styled-component/get-styled-component-call.d.ts +6 -0
  135. package/dist/types-ts4.5/rules/no-html-button/node-types/styled-component/index.d.ts +8 -0
  136. package/dist/types-ts4.5/rules/no-html-button/node-types/supported.d.ts +7 -0
  137. package/dist/types-ts4.5/rules/no-html-button/utils/get-jsx-element-by-name.d.ts +6 -0
  138. package/dist/types-ts4.5/rules/use-popup-label/index.d.ts +3 -0
  139. package/dist/types-ts4.5/rules/use-tokens-typography/utils.d.ts +0 -33
  140. package/package.json +4 -3
  141. package/constellation/no-html-button-element/usage.mdx +0 -26
  142. package/dist/cjs/rules/no-html-button-element/index.js +0 -107
  143. package/dist/cjs/rules/no-html-button-element/utils.js +0 -18
  144. package/dist/es2019/rules/no-html-button-element/index.js +0 -101
  145. package/dist/es2019/rules/no-html-button-element/utils.js +0 -12
  146. package/dist/esm/rules/no-html-button-element/index.js +0 -101
  147. package/dist/esm/rules/no-html-button-element/utils.js +0 -12
  148. package/dist/types/rules/no-html-button-element/utils.d.ts +0 -2
  149. package/dist/types-ts4.5/rules/no-html-button-element/utils.d.ts +0 -2
  150. /package/dist/types-ts4.5/rules/{no-html-button-element → no-html-anchor}/index.d.ts +0 -0
  151. /package/dist/{types/rules/no-html-button-element → types-ts4.5/rules/no-html-button}/index.d.ts +0 -0
@@ -1,9 +1,9 @@
1
1
  # no-physical-properties
2
2
 
3
- Disallows using physical properties. Physical properties
4
- prevent correct support for different reading modes and languages and
5
- should be avoided. Rule will autofix applicable physical properties
6
- to instead use [logical properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_logical_properties_and_values/Basic_concepts_of_logical_properties_and_values).
3
+ Disallows using physical properties. Physical properties prevent correct support for different
4
+ reading modes and languages and should be avoided. Rule will autofix applicable physical properties
5
+ to instead use
6
+ [logical properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_logical_properties_and_values/Basic_concepts_of_logical_properties_and_values).
7
7
 
8
8
  ## Examples
9
9
 
@@ -13,22 +13,22 @@ This rule checks for physical property usage inside of `css` function calls.
13
13
 
14
14
  ```js
15
15
  css({
16
- left: 0,
17
- right: 0,
18
- top: 0,
19
- bottom: 0,
16
+ left: 0,
17
+ right: 0,
18
+ top: 0,
19
+ bottom: 0,
20
20
  });
21
21
  ```
22
22
 
23
23
  ```js
24
24
  css({
25
- marginLeft: 0,
25
+ marginLeft: 0,
26
26
  });
27
27
  ```
28
28
 
29
29
  ```js
30
30
  css({
31
- textAlign: 'left',
31
+ textAlign: 'left',
32
32
  });
33
33
  ```
34
34
 
@@ -36,18 +36,18 @@ css({
36
36
 
37
37
  ```js
38
38
  css({
39
- inset: 0,
39
+ inset: 0,
40
40
  });
41
41
  ```
42
42
 
43
43
  ```js
44
44
  css({
45
- marginInlineStart: 0,
45
+ marginInlineStart: 0,
46
46
  });
47
47
  ```
48
48
 
49
49
  ```js
50
50
  css({
51
- textAlign: 'start',
51
+ textAlign: 'start',
52
52
  });
53
53
  ```
@@ -1,8 +1,11 @@
1
1
  # no-styled-tagged-template-expression
2
2
 
3
- Disallows any `styled` tagged template expressions that originate from a CSS-in-JS library, including `@atlaskit/css`, `@compiled/react`, Emotion, and `styled-components`.
3
+ Disallows any `styled` tagged template expressions that originate from a CSS-in-JS library,
4
+ including `@atlaskit/css`, `@compiled/react`, Emotion, and `styled-components`.
4
5
 
5
- Tagged template expressions are difficult to parse correctly (which can lead to more frequent build failures or invalid CSS generation), have limited type safety, and lack syntax highlighting. These problems can be avoided by using the preferred call expression syntax instead.
6
+ Tagged template expressions are difficult to parse correctly (which can lead to more frequent build
7
+ failures or invalid CSS generation), have limited type safety, and lack syntax highlighting. These
8
+ problems can be avoided by using the preferred call expression syntax instead.
6
9
 
7
10
  The `--fix` option on the command line automatically fixes problems reported by this rule.
8
11
 
@@ -14,21 +17,21 @@ The `--fix` option on the command line automatically fixes problems reported by
14
17
  import { styled } from '@compiled/react';
15
18
 
16
19
  const InlinedStyles = styled.div`
17
- color: blue;
20
+ color: blue;
18
21
  `;
19
22
 
20
23
  const MultilineStyles = styled.div`
21
- color: blue;
22
- font-weight: 500;
24
+ color: blue;
25
+ font-weight: 500;
23
26
  `;
24
27
 
25
28
  const ComposedStyles = styled(InlinedStyles)`
26
- font-weight: 500;
29
+ font-weight: 500;
27
30
  `;
28
31
 
29
32
  const DynamicStyles = styled.div`
30
- color: ${(props) => props.color};
31
- ${(props) => (props.disabled ? 'opacity: 0.8' : 'opacity: 1')}
33
+ color: ${(props) => props.color};
34
+ ${(props) => (props.disabled ? 'opacity: 0.8' : 'opacity: 1')}
32
35
  `;
33
36
  ```
34
37
 
@@ -38,23 +41,23 @@ const DynamicStyles = styled.div`
38
41
  import { styled } from '@compiled/react';
39
42
 
40
43
  const InlinedStyles = styled.div({
41
- color: 'blue',
44
+ color: 'blue',
42
45
  });
43
46
 
44
47
  const MultilineStyles = styled.div({
45
- color: 'blue',
46
- fontWeight: 500,
48
+ color: 'blue',
49
+ fontWeight: 500,
47
50
  });
48
51
 
49
52
  const ComposedStyles = styled(InlinedStyles)({
50
- fontWeight: 500,
53
+ fontWeight: 500,
51
54
  });
52
55
 
53
56
  const DynamicStyles = styled.div(
54
- {
55
- color: (props) => props.color,
56
- },
57
- (props) => (props.disabled ? 'opacity: 0.8' : 'opacity: 1'),
57
+ {
58
+ color: (props) => props.color,
59
+ },
60
+ (props) => (props.disabled ? 'opacity: 0.8' : 'opacity: 1'),
58
61
  );
59
62
  ```
60
63
 
@@ -64,15 +67,16 @@ const DynamicStyles = styled.div(
64
67
 
65
68
  By default, this rule will check `styled` usages from:
66
69
 
67
- - `@atlaskit/css`
68
- - `@atlaskit/primitives`
69
- - `@compiled/react`
70
- - `@emotion/react`
71
- - `@emotion/core`
72
- - `@emotion/styled`
73
- - `styled-components`
70
+ - `@atlaskit/css`
71
+ - `@atlaskit/primitives`
72
+ - `@compiled/react`
73
+ - `@emotion/react`
74
+ - `@emotion/core`
75
+ - `@emotion/styled`
76
+ - `styled-components`
74
77
 
75
- To change this list of libraries, you can define a custom set of `importSources`, which accepts an array of package names (strings).
78
+ To change this list of libraries, you can define a custom set of `importSources`, which accepts an
79
+ array of package names (strings).
76
80
 
77
81
  ```tsx
78
82
  // [{ importSources: ['other-lib'] }]
@@ -85,8 +89,8 @@ export const Component = styled.div``;
85
89
 
86
90
  ## Limitations
87
91
 
88
- - Comments are not fixable.
89
- - Component selectors are not fixable for `styled-components`.
92
+ - Comments are not fixable.
93
+ - Component selectors are not fixable for `styled-components`.
90
94
 
91
95
  Do not migrate to this object syntax manually, it is invalid `styled-components`.
92
96
 
@@ -106,25 +110,26 @@ Instead, style the button directly—make it clear that you're styling that butt
106
110
  ```tsx
107
111
  const buttonStyles = css({ color: 'blue' });
108
112
  const Wrapper = styled.div({
109
- color: 'red',
113
+ color: 'red',
110
114
  });
111
115
 
112
116
  <Wrapper>
113
- <button css={buttonStyles} />
117
+ <button css={buttonStyles} />
114
118
  </Wrapper>;
115
119
  ```
116
120
 
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.
121
+ If that's not feasible, you can use data attributes, but these will result in failing the UI Styling
122
+ Standard around nested styles, pushing the error down the road.
118
123
 
119
124
  ```tsx
120
125
  const Wrapper = styled.div({
121
- color: 'red',
122
- '[data-component-selector="my.button"]': {
123
- color: 'blue',
124
- },
126
+ color: 'red',
127
+ '[data-component-selector="my.button"]': {
128
+ color: 'blue',
129
+ },
125
130
  });
126
131
 
127
132
  <Wrapper>
128
- <button data-component-selector="my.button" />
133
+ <button data-component-selector="my.button" />
129
134
  </Wrapper>;
130
135
  ```
@@ -1,11 +1,12 @@
1
1
  # no-unsafe-design-token-usage
2
2
 
3
- Using design tokens in an unsafe way risks the health of the system and will effect how fast your codebase can migrate between versions.
3
+ Using design tokens in an unsafe way risks the health of the system and will effect how fast your
4
+ codebase can migrate between versions.
4
5
 
5
6
  ## Examples
6
7
 
7
- This rule will mark design token usage that is not statically and locally analyzable,
8
- as well as design tokens that are considered deleted.
8
+ This rule will mark design token usage that is not statically and locally analyzable, as well as
9
+ design tokens that are considered deleted.
9
10
 
10
11
  ## Incorrect
11
12
 
@@ -29,7 +30,7 @@ import { token } from '@atlaskit/tokens';
29
30
  css({ boxShadow: token('elevation.shadow.card') });
30
31
 
31
32
  css`
32
- color: ${(token('color.text.highemphasis'), N20)};
33
+ color: ${(token('color.text.highemphasis'), N20)};
33
34
  `;
34
35
  ```
35
36
 
@@ -39,9 +40,9 @@ This rule comes with options to aid in migrating to design tokens.
39
40
 
40
41
  ### fallbackUsage
41
42
 
42
- - `forced`: Fallback values must always be provided
43
- - `none`: Fallback values must never be provided. (Fixer will remove is provided)
44
- - `optional`: Fallbacks are optional
43
+ - `forced`: Fallback values must always be provided
44
+ - `none`: Fallback values must never be provided. (Fixer will remove is provided)
45
+ - `optional`: Fallbacks are optional
45
46
 
46
47
  ### shouldEnforceFallbacks (deprecated)
47
48
 
@@ -1,8 +1,11 @@
1
1
  # no-unsafe-style-overrides
2
2
 
3
- Unsafe style overrides cause friction and incidents when internals of the component you're overriding change. They're inherently unbounded and everything is API that can change at a moments notice.
3
+ Unsafe style overrides cause friction and incidents when internals of the component you're
4
+ overriding change. They're inherently unbounded and everything is API that can change at a moments
5
+ notice.
4
6
 
5
- Instead, lean on composition, primitive components, and safe style overrides via the `xcss` prop where component authors declare what styles they want to support.
7
+ Instead, lean on composition, primitive components, and safe style overrides via the `xcss` prop
8
+ where component authors declare what styles they want to support.
6
9
 
7
10
  ## Examples
8
11
 
@@ -33,7 +36,7 @@ import { ButtonItem } from '@atlaskit/side-navigation';
33
36
 
34
37
  ```tsx
35
38
  <Button>
36
- <strong>foo</strong>
39
+ <strong>foo</strong>
37
40
  </Button>
38
41
  ```
39
42
 
@@ -41,9 +44,9 @@ import { ButtonItem } from '@atlaskit/side-navigation';
41
44
  const styles = css({ padding: 'var(--ds-space-100)' });
42
45
 
43
46
  <Box as="a" xcss={styles}>
44
- <Stack>
45
- <Inline />
46
- <Inline />
47
- </Stack>
47
+ <Stack>
48
+ <Inline />
49
+ <Inline />
50
+ </Stack>
48
51
  </Box>;
49
52
  ```
@@ -1,10 +1,16 @@
1
1
  # no-unsupported-drag-and-drop-libraries
2
2
 
3
- We encourage the use of Pragmatic drag and drop to power all drag and drop experiences - from table to external files. Pragmatic drag and drop is a performance optimised drag and drop framework that has been designed to power any drag and drop experience on any tech stack. Please avoid using alternative drag and drop libraries as it will lead to poorer performance, increased maintenance costs, (likely) worse accessibility and fragmented user experiences. See https://staging.atlassian.design/components/pragmatic-drag-and-drop/
3
+ We encourage the use of Pragmatic drag and drop to power all drag and drop experiences - from table
4
+ to external files. Pragmatic drag and drop is a performance optimised drag and drop framework that
5
+ has been designed to power any drag and drop experience on any tech stack. Please avoid using
6
+ alternative drag and drop libraries as it will lead to poorer performance, increased maintenance
7
+ costs, (likely) worse accessibility and fragmented user experiences. See
8
+ https://staging.atlassian.design/components/pragmatic-drag-and-drop/
4
9
 
5
10
  ## Examples
6
11
 
7
- Libraries such as `react-beautiful-dnd` and `@atlassian/jira-dnd` that are no longer supported, as well as external libraries such as `react-dnd` and `react-sortable-hoc`.
12
+ Libraries such as `react-beautiful-dnd` and `@atlassian/jira-dnd` that are no longer supported, as
13
+ well as external libraries such as `react-dnd` and `react-sortable-hoc`.
8
14
 
9
15
  ### Incorrect
10
16
 
@@ -1,6 +1,7 @@
1
1
  # prefer-primitives
2
2
 
3
- Using primitives allows you to delete bespoke component code and replace it with ready made solutions made by the Atlassian Design System Team.
3
+ Using primitives allows you to delete bespoke component code and replace it with ready made
4
+ solutions made by the Atlassian Design System Team.
4
5
 
5
6
  ## Examples
6
7
 
@@ -26,6 +27,6 @@ This rule marks code as violations when it may be able to be replaced with a pri
26
27
 
27
28
  ```js
28
29
  <Component>
29
- <Box xcss={someStyles}></Box>
30
+ <Box xcss={someStyles}></Box>
30
31
  </Component>
31
32
  ```
@@ -1,10 +1,12 @@
1
1
  # use-button-group-label
2
2
 
3
- ButtonGroup should have an accessible name or a reference to it, so that upon opening, users of assistive technologies could have contextual information of interaction with current element.
3
+ ButtonGroup should have an accessible name or a reference to it, so that upon opening, users of
4
+ assistive technologies could have contextual information of interaction with current element.
4
5
 
5
6
  ## Examples
6
7
 
7
- This rule will indicate user with warning to strongly recommend usage of either `label` or `titleId` prop.
8
+ This rule will indicate user with warning to strongly recommend usage of either `label` or `titleId`
9
+ prop.
8
10
 
9
11
  ### Incorrect
10
12
 
@@ -1,10 +1,12 @@
1
1
  # use-drawer-label
2
2
 
3
- Drawer should have an accessible name or a reference to it, so that upon opening, users of assistive technologies could have contextual information of interaction with current element.
3
+ Drawer should have an accessible name or a reference to it, so that upon opening, users of assistive
4
+ technologies could have contextual information of interaction with current element.
4
5
 
5
6
  ## Examples
6
7
 
7
- This rule will indicate user with warning to strongly recommend usage of either `label` or `titleId` prop.
8
+ This rule will indicate user with warning to strongly recommend usage of either `label` or `titleId`
9
+ prop.
8
10
 
9
11
  ### Incorrect
10
12
 
@@ -1,6 +1,7 @@
1
1
  # use-heading
2
2
 
3
- Using primitives allows you to delete bespoke component code and replace it with ready made solutions made by the Atlassian Design System Team.
3
+ Using primitives allows you to delete bespoke component code and replace it with ready made
4
+ solutions made by the Atlassian Design System Team.
4
5
 
5
6
  ## Examples
6
7
 
@@ -20,9 +21,11 @@ This rule marks code as violations when it can be replaced 1:1 with a heading co
20
21
 
21
22
  ```jsx
22
23
  <div>
23
- <Heading size="xlarge">text</Heading>
24
- <p>content</p>
24
+ <Heading size="xlarge">text</Heading>
25
+ <p>content</p>
25
26
  </div>
26
27
  ```
27
28
 
28
- Currently, the rule is extremely defensive, only reporting on `h1`, `h2`, `h3`, `h4`, `h5` and `h6` elements that don't have any props outside of `key`, `id` and `data-testid`. We're only targeting instances that are the first child of their siblings.
29
+ Currently, the rule is extremely defensive, only reporting on `h1`, `h2`, `h3`, `h4`, `h5` and `h6`
30
+ elements that don't have any props outside of `key`, `id` and `data-testid`. We're only targeting
31
+ instances that are the first child of their siblings.
@@ -1,6 +1,7 @@
1
1
  # use-heading-level-in-spotlight-card
2
2
 
3
- The `SpotlightCard` component in `@atlaskit/onboarding` will be requiring the `headingLevel` prop in future releases.
3
+ The `SpotlightCard` component in `@atlaskit/onboarding` will be requiring the `headingLevel` prop in
4
+ future releases.
4
5
 
5
6
  ## Examples
6
7
 
@@ -15,6 +16,6 @@ The `SpotlightCard` component in `@atlaskit/onboarding` will be requiring the `h
15
16
 
16
17
  ```tsx
17
18
  <SpotlightCard heading="Heading" headingLevel={2}>
18
- Spotlight card contents
19
+ Spotlight card contents
19
20
  </SpotlightCard>
20
21
  ```
@@ -1,6 +1,7 @@
1
1
  # use-href-in-link-item
2
2
 
3
- The `LinkItem` component in `@atlaskit/menu` will be requiring the `href` prop in future releases. If no valid `href` prop is required, consider using the `ButtonItem` component.
3
+ The `LinkItem` component in `@atlaskit/menu` will be requiring the `href` prop in future releases.
4
+ If no valid `href` prop is required, consider using the `ButtonItem` component.
4
5
 
5
6
  ## Examples
6
7
 
@@ -0,0 +1,56 @@
1
+ # use-popup-label
2
+
3
+ Popup should have an accessible name or a reference to it when `role="dialog"`, so that upon
4
+ opening, users of assistive technologies could have contextual information of interaction with
5
+ current element.
6
+
7
+ ## Examples
8
+
9
+ This rule will indicate user with warning to strongly recommend usage of either `label` or `titleId`
10
+ prop.
11
+
12
+ ### Incorrect
13
+
14
+ ```tsx
15
+ <Popup role="dialog">
16
+ ^^^^^^ Missing either `label` or `titleId` prop.
17
+ Popup content
18
+ </Popup>
19
+
20
+ <Popup role="dialog" label>
21
+ ^^^^^ `label` prop is missing value.
22
+ Popup content
23
+ </Popup>
24
+
25
+ <Popup role="dialog" label="">
26
+ ^^^^^ `label` prop is missing accessible name value.
27
+ Popup content
28
+ </Popup>
29
+
30
+ <Popup role="dialog" titleId>
31
+ ^^^^^^^ `titleId` prop is missing reference value.
32
+ <h1 id="popup-title">Popup content title</hi>
33
+ </Popup>
34
+
35
+ <Popup role="dialog" titleId="">
36
+ ^^^^^^^ `titleId` prop is missing reference value.
37
+ <h1 id="popup-title">Popup content title</hi>
38
+ </Popup>
39
+
40
+ <Popup role="dialog" titleId="popup-title" label="">
41
+ ^^^^^^^ ^^^^^ Do not include both `titleId` and `label` properties. Use `titleId` if the label text is available in the DOM to reference it, otherwise use `label` to provide accessible name explicitly.
42
+ <h1 id="popup-title">Popup content title</hi>
43
+ </Popup>
44
+ ```
45
+
46
+ ### Correct
47
+
48
+ ```tsx
49
+ <Popup role="dialog" label="Popup content title">
50
+ Popup content
51
+ </Popup>
52
+
53
+ <Popup role="dialog" titleId="popup-title">
54
+ <h1 id="popup-title">Popup content title</hi>
55
+ </Popup>
56
+ ```
@@ -1,6 +1,7 @@
1
1
  # use-primitives
2
2
 
3
- Using primitives allows you to delete bespoke component code and replace it with ready made solutions made by the Atlassian Design System Team.
3
+ Using primitives allows you to delete bespoke component code and replace it with ready made
4
+ solutions made by the Atlassian Design System Team.
4
5
 
5
6
  ## Examples
6
7
 
@@ -33,45 +34,45 @@ const someStyles = xcss({
33
34
 
34
35
  Currently, the rule is extremely defensive, only reporting on `css` styles that contain:
35
36
 
36
- - one, and only one, style property from this list:
37
+ - one, and only one, style property from this list:
37
38
 
38
- - padding
39
- - paddingBlock
40
- - paddingBlockEnd
41
- - paddingBlockStart
42
- - paddingBottom
43
- - paddingInline
44
- - paddingInlineEnd
45
- - paddingInlineStart
46
- - paddingLeft
47
- - paddingRight
48
- - paddingTop
49
- - margin
50
- - marginBlock
51
- - marginBlockEnd
52
- - marginBlockStart
53
- - marginBottom
54
- - marginInline
55
- - marginInlineEnd
56
- - marginInlineStart
57
- - marginLeft
58
- - marginRight
59
- - marginTop
39
+ - padding
40
+ - paddingBlock
41
+ - paddingBlockEnd
42
+ - paddingBlockStart
43
+ - paddingBottom
44
+ - paddingInline
45
+ - paddingInlineEnd
46
+ - paddingInlineStart
47
+ - paddingLeft
48
+ - paddingRight
49
+ - paddingTop
50
+ - margin
51
+ - marginBlock
52
+ - marginBlockEnd
53
+ - marginBlockStart
54
+ - marginBottom
55
+ - marginInline
56
+ - marginInlineEnd
57
+ - marginInlineStart
58
+ - marginLeft
59
+ - marginRight
60
+ - marginTop
60
61
 
61
- - and where the style value is one of:
62
- - 0px
63
- - 2px
64
- - 4px
65
- - 6px
66
- - 8px
67
- - 12px
68
- - 16px
69
- - 20px
70
- - 24px
71
- - 32px
72
- - 40px
73
- - 48px
74
- - 64px
75
- - 80px
62
+ - and where the style value is one of:
63
+ - 0px
64
+ - 2px
65
+ - 4px
66
+ - 6px
67
+ - 8px
68
+ - 12px
69
+ - 16px
70
+ - 20px
71
+ - 24px
72
+ - 32px
73
+ - 40px
74
+ - 48px
75
+ - 64px
76
+ - 80px
76
77
 
77
78
  If these conditions are not met, then no violation will be reported.
@@ -1,10 +1,12 @@
1
1
  # use-primitives-text
2
2
 
3
- Using primitives allows you to delete bespoke component code and replace it with ready made solutions made by the Atlassian Design System Team.
3
+ Using primitives allows you to delete bespoke component code and replace it with ready made
4
+ solutions made by the Atlassian Design System Team.
4
5
 
5
6
  ## Examples
6
7
 
7
- This rule marks code as violations when it can be replaced 1:1 with one or multiple primitive components.
8
+ This rule marks code as violations when it can be replaced 1:1 with one or multiple primitive
9
+ components.
8
10
 
9
11
  ### Incorrect
10
12
 
@@ -28,4 +30,6 @@ This rule marks code as violations when it can be replaced 1:1 with one or multi
28
30
  <Text as="em">text</Text>
29
31
  ```
30
32
 
31
- Currently, the rule is extremely defensive, only reporting on `span`, `p`, `strong` and `em` elements that don't have any props outside of `key`, `id` and `data-testid`. For `span` elements we're only targeting instances that almost certainly only have text as children.
33
+ Currently, the rule is extremely defensive, only reporting on `span`, `p`, `strong` and `em`
34
+ elements that don't have any props outside of `key`, `id` and `data-testid`. For `span` elements
35
+ we're only targeting instances that almost certainly only have text as children.
@@ -2,7 +2,9 @@
2
2
 
3
3
  ## Examples
4
4
 
5
- This rule marks code as violations when a space token should be used. It will auto-fix values that can be mapped 1:1 with an ADS space token. Values that can't be mapped to a token will still be reported, however no auto-fix will happen.
5
+ This rule marks code as violations when a space token should be used. It will auto-fix values that
6
+ can be mapped 1:1 with an ADS space token. Values that can't be mapped to a token will still be
7
+ reported, however no auto-fix will happen.
6
8
 
7
9
  ### Incorrect
8
10
 
@@ -23,8 +25,10 @@ const someStyles = css({
23
25
  })
24
26
  ```
25
27
 
26
- See the list of available space tokens on the [ADS website](https://atlassian.design/foundations/spacing#space-tokens).
28
+ See the list of available space tokens on the
29
+ [ADS website](https://atlassian.design/foundations/spacing#space-tokens).
27
30
 
28
31
  For Atlassians:
29
32
 
30
- - See the [Token Migration Guide](https://go.atlassian.com/space-token-migration) for instructions on how to migrate to tokens when a suggestion is not provided by the ESLint rule.
33
+ - See the [Token Migration Guide](https://go.atlassian.com/space-token-migration) for instructions
34
+ on how to migrate to tokens when a suggestion is not provided by the ESLint rule.
@@ -2,14 +2,22 @@
2
2
 
3
3
  Enforces the use of design tokens for typography properties.
4
4
 
5
- Using design tokens results in a harmonious experience for end users whilst providing theming and consistency.
6
- Typography tokens are strongly recommended to further align our experiences and make future changes easier.
7
-
8
- Note: This rule is fairly defensive when it comes to replacing values with tokens. It will only run over style blocks that contain a fontSize property. It will then attempt to match that font size to a token. If multiple matching tokens are found it then tries to match on font weight. If a token can be found to match the font size but not font weight, the token is applied and then a font weight token override is applied to ensure the tokenised styles match the original. One main exception is line height - **this rule will match against tokens that have a different line height**. Letter spacing values are also ignored.
5
+ Using design tokens results in a harmonious experience for end users whilst providing theming and
6
+ consistency. Typography tokens are strongly recommended to further align our experiences and make
7
+ future changes easier.
8
+
9
+ Note: This rule is fairly defensive when it comes to replacing values with tokens. It will only run
10
+ over style blocks that contain a fontSize property. It will then attempt to match that font size to
11
+ a token. If multiple matching tokens are found it then tries to match on font weight. If a token can
12
+ be found to match the font size but not font weight, the token is applied and then a font weight
13
+ token override is applied to ensure the tokenised styles match the original. One main exception is
14
+ line height - **this rule will match against tokens that have a different line height**. Letter
15
+ spacing values are also ignored.
9
16
 
10
17
  ## Examples
11
18
 
12
- Using anything other than design tokens such as hardcoded values or legacy theme constants will be considered violations.
19
+ Using anything other than design tokens such as hardcoded values or legacy theme constants will be
20
+ considered violations.
13
21
 
14
22
  ### Incorrect
15
23
 
@@ -43,4 +51,5 @@ css({ font: token('font.body') });
43
51
 
44
52
  ## Options
45
53
 
46
- `shouldEnforceFallbacks`: Set to `false` to ensure token fallback values are not added. Defaults to `true`.
54
+ `shouldEnforceFallbacks`: Set to `false` to ensure token fallback values are not added. Defaults to
55
+ `true`.
@@ -1,6 +1,7 @@
1
1
  # use-visually-hidden
2
2
 
3
- Using the visually hidden component allows you to delete bespoke or legacy theme code and replace it with a ready made solution by the Atlassian Design System Team.
3
+ Using the visually hidden component allows you to delete bespoke or legacy theme code and replace it
4
+ with a ready made solution by the Atlassian Design System Team.
4
5
 
5
6
  ## Examples
6
7