@atlaskit/eslint-plugin-design-system 10.10.0 → 10.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/rules/no-legacy-icons/checks.js +63 -67
  3. package/dist/cjs/rules/no-legacy-icons/helpers.js +29 -24
  4. package/dist/cjs/rules/no-legacy-icons/index.js +4 -5
  5. package/dist/cjs/rules/use-latest-xcss-syntax/transformers/style-property/supported.js +3 -2
  6. package/dist/cjs/rules/use-tokens-space/transformers/style-property/supported.js +3 -2
  7. package/dist/cjs/rules/use-visually-hidden/fix-jsx.js +4 -2
  8. package/dist/cjs/rules/use-visually-hidden/fix-vanilla.js +4 -2
  9. package/dist/es2019/rules/no-legacy-icons/checks.js +20 -33
  10. package/dist/es2019/rules/no-legacy-icons/helpers.js +24 -21
  11. package/dist/es2019/rules/no-legacy-icons/index.js +4 -5
  12. package/dist/es2019/rules/use-latest-xcss-syntax/transformers/style-property/supported.js +3 -2
  13. package/dist/es2019/rules/use-tokens-space/transformers/style-property/supported.js +3 -2
  14. package/dist/es2019/rules/use-visually-hidden/fix-jsx.js +3 -2
  15. package/dist/es2019/rules/use-visually-hidden/fix-vanilla.js +3 -2
  16. package/dist/esm/rules/no-legacy-icons/checks.js +64 -68
  17. package/dist/esm/rules/no-legacy-icons/helpers.js +28 -23
  18. package/dist/esm/rules/no-legacy-icons/index.js +4 -5
  19. package/dist/esm/rules/use-latest-xcss-syntax/transformers/style-property/supported.js +3 -2
  20. package/dist/esm/rules/use-tokens-space/transformers/style-property/supported.js +3 -2
  21. package/dist/esm/rules/use-visually-hidden/fix-jsx.js +3 -2
  22. package/dist/esm/rules/use-visually-hidden/fix-vanilla.js +3 -2
  23. package/dist/types/rules/no-legacy-icons/helpers.d.ts +3 -13
  24. package/dist/types/rules/use-latest-xcss-syntax/transformers/style-property/supported.d.ts +2 -2
  25. package/dist/types/rules/use-tokens-space/transformers/style-property/supported.d.ts +2 -2
  26. package/dist/types/rules/use-visually-hidden/fix-jsx.d.ts +2 -2
  27. package/dist/types/rules/use-visually-hidden/fix-vanilla.d.ts +2 -2
  28. package/dist/types-ts4.5/rules/no-legacy-icons/helpers.d.ts +3 -13
  29. package/dist/types-ts4.5/rules/use-latest-xcss-syntax/transformers/style-property/supported.d.ts +2 -2
  30. package/dist/types-ts4.5/rules/use-tokens-space/transformers/style-property/supported.d.ts +2 -2
  31. package/dist/types-ts4.5/rules/use-visually-hidden/fix-jsx.d.ts +2 -2
  32. package/dist/types-ts4.5/rules/use-visually-hidden/fix-vanilla.d.ts +2 -2
  33. package/package.json +2 -2
  34. package/constellation/consistent-css-prop-usage/usage.mdx +0 -210
  35. package/constellation/ensure-design-token-usage/usage.mdx +0 -77
  36. package/constellation/ensure-design-token-usage-preview/usage.mdx +0 -6
  37. package/constellation/icon-label/usage.mdx +0 -41
  38. package/constellation/index/props.mdx +0 -30
  39. package/constellation/index/usage.mdx +0 -57
  40. package/constellation/no-banned-imports/usage.mdx +0 -19
  41. package/constellation/no-css-tagged-template-expression/usage.mdx +0 -71
  42. package/constellation/no-custom-icons/usage.mdx +0 -36
  43. package/constellation/no-deprecated-apis/usage.mdx +0 -82
  44. package/constellation/no-deprecated-design-token-usage/usage.mdx +0 -30
  45. package/constellation/no-deprecated-imports/usage.mdx +0 -66
  46. package/constellation/no-direct-use-of-web-platform-drag-and-drop/usage.mdx +0 -149
  47. package/constellation/no-empty-styled-expression/usage.mdx +0 -82
  48. package/constellation/no-exported-css/usage.mdx +0 -55
  49. package/constellation/no-exported-keyframes/usage.mdx +0 -55
  50. package/constellation/no-html-anchor/usage.mdx +0 -46
  51. package/constellation/no-html-button/usage.mdx +0 -52
  52. package/constellation/no-invalid-css-map/usage.mdx +0 -210
  53. package/constellation/no-keyframes-tagged-template-expression/usage.mdx +0 -80
  54. package/constellation/no-legacy-icons/usage.mdx +0 -42
  55. package/constellation/no-margin/usage.mdx +0 -21
  56. package/constellation/no-nested-styles/usage.mdx +0 -47
  57. package/constellation/no-physical-properties/usage.mdx +0 -53
  58. package/constellation/no-styled-tagged-template-expression/usage.mdx +0 -135
  59. package/constellation/no-unsafe-design-token-usage/usage.mdx +0 -50
  60. package/constellation/no-unsafe-style-overrides/usage.mdx +0 -52
  61. package/constellation/no-unsupported-drag-and-drop-libraries/usage.mdx +0 -23
  62. package/constellation/prefer-primitives/usage.mdx +0 -32
  63. package/constellation/use-button-group-label/usage.mdx +0 -60
  64. package/constellation/use-drawer-label/usage.mdx +0 -55
  65. package/constellation/use-heading/usage.mdx +0 -31
  66. package/constellation/use-heading-level-in-spotlight-card/usage.mdx +0 -21
  67. package/constellation/use-href-in-link-item/usage.mdx +0 -19
  68. package/constellation/use-latest-xcss-syntax/usage.mdx +0 -33
  69. package/constellation/use-latest-xcss-syntax-typography/usage.mdx +0 -34
  70. package/constellation/use-menu-section-title/usage.mdx +0 -55
  71. package/constellation/use-popup-label/usage.mdx +0 -56
  72. package/constellation/use-primitives/usage.mdx +0 -78
  73. package/constellation/use-primitives-text/usage.mdx +0 -35
  74. package/constellation/use-tokens-space/usage.mdx +0 -34
  75. package/constellation/use-tokens-typography/usage.mdx +0 -55
  76. package/constellation/use-visually-hidden/usage.mdx +0 -35
@@ -1,52 +0,0 @@
1
- # no-unsafe-style-overrides
2
-
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.
6
-
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.
9
-
10
- ## Examples
11
-
12
- ### Incorrect
13
-
14
- ```tsx
15
- import Button from '@atlaskit/button';
16
-
17
- <Button css={{ fontWeight: 500 }}>foo</Button>;
18
- ^^^
19
- ```
20
-
21
- ```tsx
22
- import { LinkItem } from '@atlaskit/menu';
23
-
24
- <LinkItem cssFn={() => ({ '> div > div': { padding: 2 } })} />;
25
- ^^^^^
26
- ```
27
-
28
- ```tsx
29
- import { ButtonItem } from '@atlaskit/side-navigation';
30
-
31
- <ButtonItem className="text-neutral-400" />;
32
- ^^^^^^^^^
33
- ```
34
-
35
- ### Correct
36
-
37
- ```tsx
38
- <Button>
39
- <strong>foo</strong>
40
- </Button>
41
- ```
42
-
43
- ```tsx
44
- const styles = css({ padding: 'var(--ds-space-100)' });
45
-
46
- <Box as="a" xcss={styles}>
47
- <Stack>
48
- <Inline />
49
- <Inline />
50
- </Stack>
51
- </Box>;
52
- ```
@@ -1,23 +0,0 @@
1
- # no-unsupported-drag-and-drop-libraries
2
-
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/
9
-
10
- ## Examples
11
-
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`.
14
-
15
- ### Incorrect
16
-
17
- ```ts
18
- import { DraggableLocation } from 'react-beautiful-dnd';
19
- ^^^^^^^^^^^^^^^^^^^
20
-
21
- import { useDrag } from 'react-dnd'
22
- ^^^^^^^^^
23
- ```
@@ -1,32 +0,0 @@
1
- # prefer-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 may be able to be replaced with a primitive component.
9
-
10
- ### Incorrect
11
-
12
- ```js
13
- <div />
14
- ^^^^^^^
15
-
16
- <Component>
17
- <div css={someStyles}></div>
18
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19
- </Component>
20
- ```
21
-
22
- ### Correct
23
-
24
- ```js
25
- <Box />
26
- ```
27
-
28
- ```js
29
- <Component>
30
- <Box xcss={someStyles}></Box>
31
- </Component>
32
- ```
@@ -1,60 +0,0 @@
1
- # use-button-group-label
2
-
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.
5
-
6
- ## Examples
7
-
8
- This rule will indicate user with warning to strongly recommend usage of either `label` or `titleId`
9
- prop.
10
-
11
- ### Incorrect
12
-
13
- ```tsx
14
- <ButtonGroup>
15
- ^^^^^^^^^^^ Missing either `label` or `titleId` prop.
16
- <Button>Save</Button>
17
- <Button>Edit</Button>
18
- <Button>Delete</Button>
19
- </ButtonGroup>
20
-
21
- <ButtonGroup label="">
22
- ^^^^^ `label` prop is missing accessible name value.
23
- <Button>Save</Button>
24
- <Button>Edit</Button>
25
- <Button>Delete</Button>
26
- </ButtonGroup>
27
-
28
- <h2 id="button-group-title">ButtonGroup content title</hi>
29
- <ButtonGroup titleId="">
30
- ^^^^^^^ `titleId` prop is missing reference value.
31
- <Button>Save</Button>
32
- <Button>Edit</Button>
33
- <Button>Delete</Button>
34
- </ButtonGroup>
35
-
36
- <h2 id="button-group-title">ButtonGroup content title</h2>
37
- <ButtonGroup titleId="button-group-title" label="">
38
- ^^^^^^^ ^^^^^ 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.
39
- <Button>Save</Button>
40
- <Button>Edit</Button>
41
- <Button>Delete</Button>
42
- </ButtonGroup>
43
- ```
44
-
45
- ### Correct
46
-
47
- ```tsx
48
- <ButtonGroup label="ButtonGroup content title">
49
- <Button>Save</Button>
50
- <Button>Edit</Button>
51
- <Button>Delete</Button>
52
- </ButtonGroup>
53
-
54
- <h2 id="button-group-title">ButtonGroup content title</h2>
55
- <ButtonGroup titleId="button-group-title">
56
- <Button>Save</Button>
57
- <Button>Edit</Button>
58
- <Button>Delete</Button>
59
- </ButtonGroup>
60
- ```
@@ -1,55 +0,0 @@
1
- # use-drawer-label
2
-
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.
5
-
6
- ## Examples
7
-
8
- This rule will indicate user with warning to strongly recommend usage of either `label` or `titleId`
9
- prop.
10
-
11
- ### Incorrect
12
-
13
- ```tsx
14
- <Drawer>
15
- ^^^^^^ Missing either `label` or `titleId` prop.
16
- Drawer content
17
- </Drawer>
18
-
19
- <Drawer label>
20
- ^^^^^ `label` prop is missing value.
21
- Drawer content
22
- </Drawer>
23
-
24
- <Drawer label="">
25
- ^^^^^ `label` prop is missing accessible name value.
26
- Drawer content
27
- </Drawer>
28
-
29
- <Drawer titleId>
30
- ^^^^^^^ `titleId` prop is missing reference value.
31
- <h1 id="drawer-title">Drawer content title</hi>
32
- </Drawer>
33
-
34
- <Drawer titleId="">
35
- ^^^^^^^ `titleId` prop is missing reference value.
36
- <h1 id="drawer-title">Drawer content title</hi>
37
- </Drawer>
38
-
39
- <Drawer titleId="drawer-title" label="">
40
- ^^^^^^^ ^^^^^ 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.
41
- <h1 id="drawer-title">Drawer content title</hi>
42
- </Drawer>
43
- ```
44
-
45
- ### Correct
46
-
47
- ```tsx
48
- <Drawer label="Drawer content title">
49
- Drawer content
50
- </Drawer>
51
-
52
- <Drawer titleId="drawer-title">
53
- <h1 id="drawer-title">Drawer content title</hi>
54
- </Drawer>
55
- ```
@@ -1,31 +0,0 @@
1
- # use-heading
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 heading component.
9
-
10
- ### Incorrect
11
-
12
- ```jsx
13
- <div>
14
- <h1>text</hi>
15
- <p>content</p>
16
- </div>
17
- ^^^^
18
- ```
19
-
20
- ### Correct
21
-
22
- ```jsx
23
- <div>
24
- <Heading size="xlarge">text</Heading>
25
- <p>content</p>
26
- </div>
27
- ```
28
-
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,21 +0,0 @@
1
- # use-heading-level-in-spotlight-card
2
-
3
- The `SpotlightCard` component in `@atlaskit/onboarding` will be requiring the `headingLevel` prop in
4
- future releases.
5
-
6
- ## Examples
7
-
8
- ### Incorrect
9
-
10
- ```tsx
11
- <SpotlightCard heading="Heading">Spotlight card contents</SpotlightCard>
12
- ^^^^^^^^^^^^^
13
- ```
14
-
15
- ### Correct
16
-
17
- ```tsx
18
- <SpotlightCard heading="Heading" headingLevel={2}>
19
- Spotlight card contents
20
- </SpotlightCard>
21
- ```
@@ -1,19 +0,0 @@
1
- # use-href-in-link-item
2
-
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.
5
-
6
- ## Examples
7
-
8
- ### Incorrect
9
-
10
- ```tsx
11
- <LinkItem>Button</LinkItem>
12
- ^^^^^^^^
13
- ```
14
-
15
- ### Correct
16
-
17
- ```tsx
18
- <LinkItem href="http://example.com">Link</LinkItem>
19
- ```
@@ -1,33 +0,0 @@
1
- # use-latest-xcss-syntax
2
-
3
- ## Description
4
-
5
- Soon, non-token values for the following properties will raise TypeScript errors. This rule prevents
6
- new violations from being written until blockers are resolved.
7
-
8
- ## Examples
9
-
10
- ### Incorrect
11
-
12
- ```jsx
13
- const someStyles = xcss({
14
- margin: '8px';
15
- ^^^^^
16
- })
17
- ```
18
-
19
- ### Correct
20
-
21
- ```jsx
22
- const someStyles = xcss({
23
- margin: 'space.100';
24
- })
25
- ```
26
-
27
- See the list of available space tokens on the
28
- [ADS website](https://atlassian.design/foundations/spacing#space-tokens).
29
-
30
- For Atlassians:
31
-
32
- - See [go/xcss-spacing](https://go.atlassian.com/xcss-spacing) for context on why this is happening,
33
- and how you can prepare.
@@ -1,34 +0,0 @@
1
- # use-latest-xcss-syntax-typography
2
-
3
- ## Description
4
-
5
- Soon, applying `fontSize`, `lineHeight`, `fontWeight` with `xcss` will be deprecated. Please refrain
6
- from adding new usages, as you will need to remove them soon anyway. As an alternative, you can use
7
- the `Text` and `Heading` primitives.
8
-
9
- ## Examples
10
-
11
- ### Incorrect
12
-
13
- ```jsx
14
- const myStyles = xcss({
15
- fontSize: '14px',
16
- ^^^^^^^^^^^^^^^^
17
- lineHeight: '20px',
18
- ^^^^^^^^^^^^^^^^^^
19
- fontWeight: 500,
20
- ^^^^^^^^^^^^^^^
21
- });
22
-
23
- <Box as="p" xcss={myStyles}>
24
- ...
25
- </Box>;
26
- ```
27
-
28
- ### Correct
29
-
30
- ```jsx
31
- import { Text } from '@atlaskit/primitives';
32
-
33
- <Text weight="medium">...</Text>;
34
- ```
@@ -1,55 +0,0 @@
1
- # use-menu-section-title
2
-
3
- Section should have an accessible title or a reference to it, so that users of assistive
4
- technologies could have contextual information of interaction with current element.
5
-
6
- ## Examples
7
-
8
- This rule will indicate user with warning to strongly recommend usage of either `title` or `titleId`
9
- prop.
10
-
11
- ### Incorrect
12
-
13
- ```tsx
14
- <Section>
15
- ^^^^^^ Missing either `title` or `titleId` prop.
16
- Section content
17
- </Section>
18
-
19
- <Section title>
20
- ^^^^^ `title` prop is missing value.
21
- Section content
22
- </Section>
23
-
24
- <Section title="">
25
- ^^^^^ `title` prop is missing accessible name value.
26
- Section content
27
- </Section>
28
-
29
- <Section titleId>
30
- ^^^^^^^ `titleId` prop is missing reference value.
31
- <h1 id="section-title">Section content title</hi>
32
- </Section>
33
-
34
- <Section titleId="">
35
- ^^^^^^^ `titleId` prop is missing reference value.
36
- <h1 id="section-title">Section content title</hi>
37
- </Section>
38
-
39
- <Section titleId="section-title" title="Accessible title">
40
- ^^^^^^^ ^^^^^ Do not include both `titleId` and `title` properties. Use `titleId` if the label text is available in the DOM to reference it, otherwise use `title` to provide accessible name explicitly.
41
- <h1 id="section-title">Section content title</hi>
42
- </Section>
43
- ```
44
-
45
- ### Correct
46
-
47
- ```tsx
48
- <Section title="Section content title">
49
- Section content
50
- </Section>
51
-
52
- <Section titleId="section-title">
53
- <h1 id="section-title">Section content title</hi>
54
- </Section>
55
- ```
@@ -1,56 +0,0 @@
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,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`.