@atlaskit/eslint-plugin-design-system 10.9.0 → 10.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +1 -0
  3. package/dist/cjs/presets/all.codegen.js +2 -1
  4. package/dist/cjs/rules/ensure-design-token-usage/index.js +199 -227
  5. package/dist/cjs/rules/index.codegen.js +3 -1
  6. package/dist/cjs/rules/no-custom-icons/checks/has-prop.js +12 -0
  7. package/dist/cjs/rules/no-custom-icons/checks/is-from-import-source.js +42 -0
  8. package/dist/cjs/rules/no-custom-icons/checks/is-imported-jsx-element.js +10 -0
  9. package/dist/cjs/rules/no-custom-icons/index.js +67 -0
  10. package/dist/cjs/rules/no-legacy-icons/checks.js +63 -67
  11. package/dist/cjs/rules/no-legacy-icons/helpers.js +29 -24
  12. package/dist/cjs/rules/no-legacy-icons/index.js +15 -88
  13. package/dist/cjs/rules/use-tokens-typography/index.js +4 -8
  14. package/dist/cjs/rules/utils/error-boundary.js +58 -11
  15. package/dist/es2019/presets/all.codegen.js +2 -1
  16. package/dist/es2019/rules/ensure-design-token-usage/index.js +16 -30
  17. package/dist/es2019/rules/index.codegen.js +3 -1
  18. package/dist/es2019/rules/no-custom-icons/checks/has-prop.js +4 -0
  19. package/dist/es2019/rules/no-custom-icons/checks/is-from-import-source.js +23 -0
  20. package/dist/es2019/rules/no-custom-icons/checks/is-imported-jsx-element.js +4 -0
  21. package/dist/es2019/rules/no-custom-icons/index.js +61 -0
  22. package/dist/es2019/rules/no-legacy-icons/checks.js +20 -33
  23. package/dist/es2019/rules/no-legacy-icons/helpers.js +24 -21
  24. package/dist/es2019/rules/no-legacy-icons/index.js +15 -70
  25. package/dist/es2019/rules/use-tokens-typography/index.js +3 -7
  26. package/dist/es2019/rules/utils/error-boundary.js +55 -11
  27. package/dist/esm/presets/all.codegen.js +2 -1
  28. package/dist/esm/rules/ensure-design-token-usage/index.js +199 -227
  29. package/dist/esm/rules/index.codegen.js +3 -1
  30. package/dist/esm/rules/no-custom-icons/checks/has-prop.js +6 -0
  31. package/dist/esm/rules/no-custom-icons/checks/is-from-import-source.js +36 -0
  32. package/dist/esm/rules/no-custom-icons/checks/is-imported-jsx-element.js +4 -0
  33. package/dist/esm/rules/no-custom-icons/index.js +61 -0
  34. package/dist/esm/rules/no-legacy-icons/checks.js +64 -68
  35. package/dist/esm/rules/no-legacy-icons/helpers.js +28 -23
  36. package/dist/esm/rules/no-legacy-icons/index.js +15 -88
  37. package/dist/esm/rules/use-tokens-typography/index.js +4 -8
  38. package/dist/esm/rules/utils/error-boundary.js +56 -10
  39. package/dist/types/index.codegen.d.ts +1 -0
  40. package/dist/types/presets/all.codegen.d.ts +2 -1
  41. package/dist/types/rules/index.codegen.d.ts +1 -0
  42. package/dist/types/rules/no-custom-icons/checks/has-prop.d.ts +2 -0
  43. package/dist/types/rules/no-custom-icons/checks/is-from-import-source.d.ts +8 -0
  44. package/dist/types/rules/no-custom-icons/checks/is-imported-jsx-element.d.ts +8 -0
  45. package/dist/types/rules/no-custom-icons/index.d.ts +3 -0
  46. package/dist/types/rules/no-legacy-icons/helpers.d.ts +3 -13
  47. package/dist/types/rules/no-legacy-icons/index.d.ts +1 -2
  48. package/dist/types/rules/utils/error-boundary.d.ts +8 -5
  49. package/dist/types-ts4.5/index.codegen.d.ts +1 -0
  50. package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -1
  51. package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
  52. package/dist/types-ts4.5/rules/no-custom-icons/checks/has-prop.d.ts +2 -0
  53. package/dist/types-ts4.5/rules/no-custom-icons/checks/is-from-import-source.d.ts +8 -0
  54. package/dist/types-ts4.5/rules/no-custom-icons/checks/is-imported-jsx-element.d.ts +8 -0
  55. package/dist/types-ts4.5/rules/no-custom-icons/index.d.ts +3 -0
  56. package/dist/types-ts4.5/rules/no-legacy-icons/helpers.d.ts +3 -13
  57. package/dist/types-ts4.5/rules/no-legacy-icons/index.d.ts +1 -2
  58. package/dist/types-ts4.5/rules/utils/error-boundary.d.ts +8 -5
  59. package/package.json +2 -2
  60. package/constellation/consistent-css-prop-usage/usage.mdx +0 -210
  61. package/constellation/ensure-design-token-usage/usage.mdx +0 -77
  62. package/constellation/ensure-design-token-usage-preview/usage.mdx +0 -6
  63. package/constellation/icon-label/usage.mdx +0 -41
  64. package/constellation/index/props.mdx +0 -30
  65. package/constellation/index/usage.mdx +0 -56
  66. package/constellation/no-banned-imports/usage.mdx +0 -19
  67. package/constellation/no-css-tagged-template-expression/usage.mdx +0 -71
  68. package/constellation/no-deprecated-apis/usage.mdx +0 -82
  69. package/constellation/no-deprecated-design-token-usage/usage.mdx +0 -30
  70. package/constellation/no-deprecated-imports/usage.mdx +0 -66
  71. package/constellation/no-direct-use-of-web-platform-drag-and-drop/usage.mdx +0 -149
  72. package/constellation/no-empty-styled-expression/usage.mdx +0 -82
  73. package/constellation/no-exported-css/usage.mdx +0 -55
  74. package/constellation/no-exported-keyframes/usage.mdx +0 -55
  75. package/constellation/no-html-anchor/usage.mdx +0 -46
  76. package/constellation/no-html-button/usage.mdx +0 -52
  77. package/constellation/no-invalid-css-map/usage.mdx +0 -210
  78. package/constellation/no-keyframes-tagged-template-expression/usage.mdx +0 -80
  79. package/constellation/no-legacy-icons/usage.mdx +0 -42
  80. package/constellation/no-margin/usage.mdx +0 -21
  81. package/constellation/no-nested-styles/usage.mdx +0 -47
  82. package/constellation/no-physical-properties/usage.mdx +0 -53
  83. package/constellation/no-styled-tagged-template-expression/usage.mdx +0 -135
  84. package/constellation/no-unsafe-design-token-usage/usage.mdx +0 -50
  85. package/constellation/no-unsafe-style-overrides/usage.mdx +0 -52
  86. package/constellation/no-unsupported-drag-and-drop-libraries/usage.mdx +0 -23
  87. package/constellation/prefer-primitives/usage.mdx +0 -32
  88. package/constellation/use-button-group-label/usage.mdx +0 -60
  89. package/constellation/use-drawer-label/usage.mdx +0 -55
  90. package/constellation/use-heading/usage.mdx +0 -31
  91. package/constellation/use-heading-level-in-spotlight-card/usage.mdx +0 -21
  92. package/constellation/use-href-in-link-item/usage.mdx +0 -19
  93. package/constellation/use-latest-xcss-syntax/usage.mdx +0 -33
  94. package/constellation/use-latest-xcss-syntax-typography/usage.mdx +0 -34
  95. package/constellation/use-menu-section-title/usage.mdx +0 -55
  96. package/constellation/use-popup-label/usage.mdx +0 -56
  97. package/constellation/use-primitives/usage.mdx +0 -78
  98. package/constellation/use-primitives-text/usage.mdx +0 -35
  99. package/constellation/use-tokens-space/usage.mdx +0 -34
  100. package/constellation/use-tokens-typography/usage.mdx +0 -55
  101. package/constellation/use-visually-hidden/usage.mdx +0 -35
@@ -1,78 +0,0 @@
1
- # use-primitives
2
-
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.
5
-
6
- ## Examples
7
-
8
- This rule marks code as violations when it can be replaced 1:1 with a primitive component.
9
-
10
- ### Incorrect
11
-
12
- ```jsx
13
- const someStyles = css({
14
- padding: '8px';
15
- })
16
-
17
- <div css={someStyles}>
18
- ^^^^^^^^^^^^^^^^^^^^^^
19
- // ...
20
- </div>
21
- ```
22
-
23
- ### Correct
24
-
25
- ```jsx
26
- const someStyles = xcss({
27
- padding: 'space.100';
28
- })
29
-
30
- <Box xcss={someStyles}>
31
- // ...
32
- </Box>
33
- ```
34
-
35
- Currently, the rule is extremely defensive, only reporting on `css` styles that contain:
36
-
37
- - one, and only one, style property from this list:
38
-
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
61
-
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
77
-
78
- If these conditions are not met, then no violation will be reported.
@@ -1,35 +0,0 @@
1
- # use-primitives-text
2
-
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.
5
-
6
- ## Examples
7
-
8
- This rule marks code as violations when it can be replaced 1:1 with one or multiple primitive
9
- components.
10
-
11
- ### Incorrect
12
-
13
- ```jsx
14
- <span>text</span>
15
- ^^^^^^
16
- <p>text</p>
17
- ^^^
18
- <strong>text</strong>
19
- ^^^^^^^^
20
- <em>text</em>
21
- ^^^^
22
- ```
23
-
24
- ### Correct
25
-
26
- ```jsx
27
- <Text>text</Text>
28
- <Text as="p">text</Text>
29
- <Text as="strong">text</Text>
30
- <Text as="em">text</Text>
31
- ```
32
-
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.
@@ -1,34 +0,0 @@
1
- # use-tokens-space
2
-
3
- ## Examples
4
-
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.
8
-
9
- ### Incorrect
10
-
11
- ```jsx
12
- const someStyles = css({
13
- padding: '8px';
14
- ^^^^^
15
- })
16
- ```
17
-
18
- ### Correct
19
-
20
- ```jsx
21
- import { token } from '@atlaskit/tokens'
22
-
23
- const someStyles = css({
24
- padding: token('space.100');
25
- })
26
- ```
27
-
28
- See the list of available space tokens on the
29
- [ADS website](https://atlassian.design/foundations/spacing#space-tokens).
30
-
31
- For Atlassians:
32
-
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.
@@ -1,55 +0,0 @@
1
- # use-tokens-typography
2
-
3
- Enforces the use of design tokens for typography properties.
4
-
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.
16
-
17
- ## Examples
18
-
19
- Using anything other than design tokens such as hardcoded values or legacy theme constants will be
20
- considered violations.
21
-
22
- ### Incorrect
23
-
24
- ```js
25
- import { fontSize } from '@atlaskit/theme/constants';
26
-
27
- css({ fontSize: fontSize() });
28
- ^^^^^^^^^^
29
-
30
- css({ fontSize: '14px' });
31
- ^^^^^^
32
-
33
- css({
34
- fontSize: '14px',
35
- ^^^^^^
36
- lineHeight: '20px',
37
- fontWeight: 600
38
- });
39
-
40
- ```
41
-
42
- ### Correct
43
-
44
- ```js
45
- import { token } from '@atlaskit/tokens';
46
-
47
- css({ font: token('font.heading.large') });
48
-
49
- css({ font: token('font.body') });
50
- ```
51
-
52
- ## Options
53
-
54
- `shouldEnforceFallbacks`: Set to `false` to ensure token fallback values are not added. Defaults to
55
- `true`.
@@ -1,35 +0,0 @@
1
- # use-visually-hidden
2
-
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.
5
-
6
- ## Examples
7
-
8
- This rule marks code as violations when it can be replaced 1:1 with the visually hidden component.
9
-
10
- ### Incorrect
11
-
12
- ```js
13
- import { css } from '@emotion/core';
14
- import { visuallyHidden } from '@atlaskit/theme/constants';
15
-
16
- const visuallyHiddenStyles = css({
17
- width: '1px',
18
- height: '1px',
19
- padding: '0',
20
- position: 'absolute',
21
- border: '0',
22
- clip: 'rect(1px, 1px, 1px, 1px)',
23
- overflow: 'hidden',
24
- whiteSpace: 'nowrap',
25
- });
26
-
27
- const VisuallyHidden = styled.span`${visuallyHidden()}`;
28
- ^^^^^^^^^^^^^^
29
- ```
30
-
31
- ### Correct
32
-
33
- ```js
34
- import VisuallyHidden from '@atlaskit/visually-hidden';
35
- ```