@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.
- package/CHANGELOG.md +19 -0
- package/README.md +1 -0
- package/dist/cjs/presets/all.codegen.js +2 -1
- package/dist/cjs/rules/ensure-design-token-usage/index.js +199 -227
- package/dist/cjs/rules/index.codegen.js +3 -1
- package/dist/cjs/rules/no-custom-icons/checks/has-prop.js +12 -0
- package/dist/cjs/rules/no-custom-icons/checks/is-from-import-source.js +42 -0
- package/dist/cjs/rules/no-custom-icons/checks/is-imported-jsx-element.js +10 -0
- package/dist/cjs/rules/no-custom-icons/index.js +67 -0
- package/dist/cjs/rules/no-legacy-icons/checks.js +63 -67
- package/dist/cjs/rules/no-legacy-icons/helpers.js +29 -24
- package/dist/cjs/rules/no-legacy-icons/index.js +15 -88
- package/dist/cjs/rules/use-tokens-typography/index.js +4 -8
- package/dist/cjs/rules/utils/error-boundary.js +58 -11
- package/dist/es2019/presets/all.codegen.js +2 -1
- package/dist/es2019/rules/ensure-design-token-usage/index.js +16 -30
- package/dist/es2019/rules/index.codegen.js +3 -1
- package/dist/es2019/rules/no-custom-icons/checks/has-prop.js +4 -0
- package/dist/es2019/rules/no-custom-icons/checks/is-from-import-source.js +23 -0
- package/dist/es2019/rules/no-custom-icons/checks/is-imported-jsx-element.js +4 -0
- package/dist/es2019/rules/no-custom-icons/index.js +61 -0
- package/dist/es2019/rules/no-legacy-icons/checks.js +20 -33
- package/dist/es2019/rules/no-legacy-icons/helpers.js +24 -21
- package/dist/es2019/rules/no-legacy-icons/index.js +15 -70
- package/dist/es2019/rules/use-tokens-typography/index.js +3 -7
- package/dist/es2019/rules/utils/error-boundary.js +55 -11
- package/dist/esm/presets/all.codegen.js +2 -1
- package/dist/esm/rules/ensure-design-token-usage/index.js +199 -227
- package/dist/esm/rules/index.codegen.js +3 -1
- package/dist/esm/rules/no-custom-icons/checks/has-prop.js +6 -0
- package/dist/esm/rules/no-custom-icons/checks/is-from-import-source.js +36 -0
- package/dist/esm/rules/no-custom-icons/checks/is-imported-jsx-element.js +4 -0
- package/dist/esm/rules/no-custom-icons/index.js +61 -0
- package/dist/esm/rules/no-legacy-icons/checks.js +64 -68
- package/dist/esm/rules/no-legacy-icons/helpers.js +28 -23
- package/dist/esm/rules/no-legacy-icons/index.js +15 -88
- package/dist/esm/rules/use-tokens-typography/index.js +4 -8
- package/dist/esm/rules/utils/error-boundary.js +56 -10
- package/dist/types/index.codegen.d.ts +1 -0
- package/dist/types/presets/all.codegen.d.ts +2 -1
- package/dist/types/rules/index.codegen.d.ts +1 -0
- package/dist/types/rules/no-custom-icons/checks/has-prop.d.ts +2 -0
- package/dist/types/rules/no-custom-icons/checks/is-from-import-source.d.ts +8 -0
- package/dist/types/rules/no-custom-icons/checks/is-imported-jsx-element.d.ts +8 -0
- package/dist/types/rules/no-custom-icons/index.d.ts +3 -0
- package/dist/types/rules/no-legacy-icons/helpers.d.ts +3 -13
- package/dist/types/rules/no-legacy-icons/index.d.ts +1 -2
- package/dist/types/rules/utils/error-boundary.d.ts +8 -5
- package/dist/types-ts4.5/index.codegen.d.ts +1 -0
- package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -1
- package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
- package/dist/types-ts4.5/rules/no-custom-icons/checks/has-prop.d.ts +2 -0
- package/dist/types-ts4.5/rules/no-custom-icons/checks/is-from-import-source.d.ts +8 -0
- package/dist/types-ts4.5/rules/no-custom-icons/checks/is-imported-jsx-element.d.ts +8 -0
- package/dist/types-ts4.5/rules/no-custom-icons/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/no-legacy-icons/helpers.d.ts +3 -13
- package/dist/types-ts4.5/rules/no-legacy-icons/index.d.ts +1 -2
- package/dist/types-ts4.5/rules/utils/error-boundary.d.ts +8 -5
- package/package.json +2 -2
- package/constellation/consistent-css-prop-usage/usage.mdx +0 -210
- package/constellation/ensure-design-token-usage/usage.mdx +0 -77
- package/constellation/ensure-design-token-usage-preview/usage.mdx +0 -6
- package/constellation/icon-label/usage.mdx +0 -41
- package/constellation/index/props.mdx +0 -30
- package/constellation/index/usage.mdx +0 -56
- package/constellation/no-banned-imports/usage.mdx +0 -19
- package/constellation/no-css-tagged-template-expression/usage.mdx +0 -71
- package/constellation/no-deprecated-apis/usage.mdx +0 -82
- package/constellation/no-deprecated-design-token-usage/usage.mdx +0 -30
- package/constellation/no-deprecated-imports/usage.mdx +0 -66
- package/constellation/no-direct-use-of-web-platform-drag-and-drop/usage.mdx +0 -149
- package/constellation/no-empty-styled-expression/usage.mdx +0 -82
- package/constellation/no-exported-css/usage.mdx +0 -55
- package/constellation/no-exported-keyframes/usage.mdx +0 -55
- package/constellation/no-html-anchor/usage.mdx +0 -46
- package/constellation/no-html-button/usage.mdx +0 -52
- package/constellation/no-invalid-css-map/usage.mdx +0 -210
- package/constellation/no-keyframes-tagged-template-expression/usage.mdx +0 -80
- package/constellation/no-legacy-icons/usage.mdx +0 -42
- package/constellation/no-margin/usage.mdx +0 -21
- package/constellation/no-nested-styles/usage.mdx +0 -47
- package/constellation/no-physical-properties/usage.mdx +0 -53
- package/constellation/no-styled-tagged-template-expression/usage.mdx +0 -135
- package/constellation/no-unsafe-design-token-usage/usage.mdx +0 -50
- package/constellation/no-unsafe-style-overrides/usage.mdx +0 -52
- package/constellation/no-unsupported-drag-and-drop-libraries/usage.mdx +0 -23
- package/constellation/prefer-primitives/usage.mdx +0 -32
- package/constellation/use-button-group-label/usage.mdx +0 -60
- package/constellation/use-drawer-label/usage.mdx +0 -55
- package/constellation/use-heading/usage.mdx +0 -31
- package/constellation/use-heading-level-in-spotlight-card/usage.mdx +0 -21
- package/constellation/use-href-in-link-item/usage.mdx +0 -19
- package/constellation/use-latest-xcss-syntax/usage.mdx +0 -33
- package/constellation/use-latest-xcss-syntax-typography/usage.mdx +0 -34
- package/constellation/use-menu-section-title/usage.mdx +0 -55
- package/constellation/use-popup-label/usage.mdx +0 -56
- package/constellation/use-primitives/usage.mdx +0 -78
- package/constellation/use-primitives-text/usage.mdx +0 -35
- package/constellation/use-tokens-space/usage.mdx +0 -34
- package/constellation/use-tokens-typography/usage.mdx +0 -55
- package/constellation/use-visually-hidden/usage.mdx +0 -35
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
# no-styled-tagged-template-expression
|
|
2
|
-
|
|
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`.
|
|
5
|
-
|
|
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.
|
|
9
|
-
|
|
10
|
-
The `--fix` option on the command line automatically fixes problems reported by this rule.
|
|
11
|
-
|
|
12
|
-
## Examples
|
|
13
|
-
|
|
14
|
-
### Incorrect
|
|
15
|
-
|
|
16
|
-
```js
|
|
17
|
-
import { styled } from '@compiled/react';
|
|
18
|
-
|
|
19
|
-
const InlinedStyles = styled.div`
|
|
20
|
-
color: blue;
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
const MultilineStyles = styled.div`
|
|
24
|
-
color: blue;
|
|
25
|
-
font-weight: 500;
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
const ComposedStyles = styled(InlinedStyles)`
|
|
29
|
-
font-weight: 500;
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
const DynamicStyles = styled.div`
|
|
33
|
-
color: ${(props) => props.color};
|
|
34
|
-
${(props) => (props.disabled ? 'opacity: 0.8' : 'opacity: 1')}
|
|
35
|
-
`;
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### Correct
|
|
39
|
-
|
|
40
|
-
```js
|
|
41
|
-
import { styled } from '@compiled/react';
|
|
42
|
-
|
|
43
|
-
const InlinedStyles = styled.div({
|
|
44
|
-
color: 'blue',
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const MultilineStyles = styled.div({
|
|
48
|
-
color: 'blue',
|
|
49
|
-
fontWeight: 500,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
const ComposedStyles = styled(InlinedStyles)({
|
|
53
|
-
fontWeight: 500,
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const DynamicStyles = styled.div(
|
|
57
|
-
{
|
|
58
|
-
color: (props) => props.color,
|
|
59
|
-
},
|
|
60
|
-
(props) => (props.disabled ? 'opacity: 0.8' : 'opacity: 1'),
|
|
61
|
-
);
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Options
|
|
65
|
-
|
|
66
|
-
### importSources
|
|
67
|
-
|
|
68
|
-
By default, this rule will check `styled` usages from:
|
|
69
|
-
|
|
70
|
-
- `@atlaskit/css`
|
|
71
|
-
- `@atlaskit/primitives`
|
|
72
|
-
- `@compiled/react`
|
|
73
|
-
- `@emotion/react`
|
|
74
|
-
- `@emotion/core`
|
|
75
|
-
- `@emotion/styled`
|
|
76
|
-
- `styled-components`
|
|
77
|
-
|
|
78
|
-
To change this list of libraries, you can define a custom set of `importSources`, which accepts an
|
|
79
|
-
array of package names (strings).
|
|
80
|
-
|
|
81
|
-
```tsx
|
|
82
|
-
// [{ importSources: ['other-lib'] }]
|
|
83
|
-
|
|
84
|
-
import { styled } from 'other-lib';
|
|
85
|
-
|
|
86
|
-
// Invalid!
|
|
87
|
-
export const Component = styled.div``;
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Limitations
|
|
91
|
-
|
|
92
|
-
- Comments are not fixable.
|
|
93
|
-
- Component selectors are not fixable for `styled-components`.
|
|
94
|
-
|
|
95
|
-
Do not migrate to this object syntax manually, it is invalid `styled-components`.
|
|
96
|
-
|
|
97
|
-
```tsx
|
|
98
|
-
const Button = styled.button``;
|
|
99
|
-
const Wrapper = styled.div({
|
|
100
|
-
color: 'red',
|
|
101
|
-
[`${Button}`]: {
|
|
102
|
-
color: 'blue',
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
<Wrapper><Button /><Wrapper>
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Instead, style the button directly—make it clear that you're styling that button.
|
|
109
|
-
|
|
110
|
-
```tsx
|
|
111
|
-
const buttonStyles = css({ color: 'blue' });
|
|
112
|
-
const Wrapper = styled.div({
|
|
113
|
-
color: 'red',
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
<Wrapper>
|
|
117
|
-
<button css={buttonStyles} />
|
|
118
|
-
</Wrapper>;
|
|
119
|
-
```
|
|
120
|
-
|
|
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.
|
|
123
|
-
|
|
124
|
-
```tsx
|
|
125
|
-
const Wrapper = styled.div({
|
|
126
|
-
color: 'red',
|
|
127
|
-
'[data-component-selector="my.button"]': {
|
|
128
|
-
color: 'blue',
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
<Wrapper>
|
|
133
|
-
<button data-component-selector="my.button" />
|
|
134
|
-
</Wrapper>;
|
|
135
|
-
```
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# no-unsafe-design-token-usage
|
|
2
|
-
|
|
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.
|
|
5
|
-
|
|
6
|
-
## Examples
|
|
7
|
-
|
|
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.
|
|
10
|
-
|
|
11
|
-
## Incorrect
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
const textColor = 'red';
|
|
15
|
-
|
|
16
|
-
css({ color: textColor });
|
|
17
|
-
^^^^^^^^^ must be a string literal
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
```js
|
|
21
|
-
css({ boxShadow: '0px 1px 1px var(--ds-accent-subtleBlue)' });
|
|
22
|
-
^^^^^^^^^^^^^^^^^^^^^^^^^^ must use the token() function
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Correct
|
|
26
|
-
|
|
27
|
-
```js
|
|
28
|
-
import { token } from '@atlaskit/tokens';
|
|
29
|
-
|
|
30
|
-
css({ boxShadow: token('elevation.shadow.card') });
|
|
31
|
-
|
|
32
|
-
css`
|
|
33
|
-
color: ${(token('color.text.highemphasis'), N20)};
|
|
34
|
-
`;
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Options
|
|
38
|
-
|
|
39
|
-
This rule comes with options to aid in migrating to design tokens.
|
|
40
|
-
|
|
41
|
-
### fallbackUsage
|
|
42
|
-
|
|
43
|
-
- `forced`: Fallback values must always be provided
|
|
44
|
-
- `none`: Fallback values must never be provided. (Fixer will remove if provided)
|
|
45
|
-
- `optional`: Fallbacks are optional
|
|
46
|
-
|
|
47
|
-
### shouldEnforceFallbacks (deprecated)
|
|
48
|
-
|
|
49
|
-
When `true` the rule will mark token function usage as violations when fallbacks aren't defined.
|
|
50
|
-
When `false` the rule will mark token function usage as violations when fallbacks are defined.
|
|
@@ -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
|
-
```
|