@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,19 +0,0 @@
1
- # no-banned-imports
2
-
3
- Using private or experimental packages is dangerous as they are not supported across major versions
4
- meaning you will not be able to migrate easily causing friction for yourself and the Atlassian
5
- Design System team.
6
-
7
- ## Examples
8
-
9
- Anything that is considered private or experimental will be marked as violations.
10
-
11
- ### Incorrect
12
-
13
- ```ts
14
- import noop from '@atlaskit/ds-lib/noop';
15
- ^^^^^^^^^^^^^^^^^^^^^
16
-
17
- import { Text } from '@atlaskit/ds-explorations';
18
- ^^^^^^^^^^^^^^^^^^^^^^^^^
19
- ```
@@ -1,71 +0,0 @@
1
- # no-css-tagged-template-expression
2
-
3
- Disallows any `css` tagged template expressions that originate from a CSS-in-JS library, including
4
- `@atlaskit/css`, `@compiled/react`, Emotion, and `styled-components`.
5
-
6
- Tagged template expressions cannot be type safe and are difficult to parse correctly. Will auto fix
7
- ` css`` ` to the preferred `css({})` call expression syntax.
8
-
9
- Thank you to the
10
- [Compiled team for their rule](https://github.com/atlassian-labs/compiled/tree/master/packages/eslint-plugin/src/rules/no-css-tagged-template-expression)
11
- from which this was ported.
12
-
13
- ## Examples
14
-
15
- ### Incorrect
16
-
17
- ```js
18
- import { css } from '@emotion/react';
19
-
20
- css`
21
- color: blue;
22
- `;
23
-
24
- const styles = css`
25
- color: blue;
26
- font-weight: 500;
27
- `;
28
- ```
29
-
30
- ### Correct
31
-
32
- ```js
33
- import { css } from '@emotion/react';
34
-
35
- css({ color: 'blue' });
36
-
37
- const styles = css({
38
- color: 'blue',
39
- fontWeight: 500,
40
- });
41
- ```
42
-
43
- ## Options
44
-
45
- ### importSources
46
-
47
- By default, this rule will check `css` usages from:
48
-
49
- - `@atlaskit/css`
50
- - `@atlaskit/primitives`
51
- - `@compiled/react`
52
- - `@emotion/react`
53
- - `@emotion/core`
54
- - `@emotion/styled`
55
- - `styled-components`
56
-
57
- To change this list of libraries, you can define a custom set of `importSources`, which accepts an
58
- array of package names (strings).
59
-
60
- ```tsx
61
- // [{ importSources: ['other-lib'] }]
62
-
63
- import { css } from 'other-lib';
64
-
65
- // Invalid!
66
- export const styles = css``;
67
- ```
68
-
69
- ## Limitations
70
-
71
- - Comments are not auto-fixable. You will need to manually convert usages containing functions.
@@ -1,36 +0,0 @@
1
- # no-custom-icons
2
-
3
- Icons are being updated with new designs, a simplified set of available icons and sizes, as well as
4
- more consistent padding and spacing.
5
-
6
- The new icon components allows your components to align with the new visual language - either by
7
- default, or when enabled via a feature flag.
8
-
9
- Custom icons are no longer supported, and should either be replaced with an existing icon from the
10
- `@atlaskit/icon` or `@atlassian/icon-lab` packages, or contributed to those packages.
11
-
12
- During the migration process, any custom icons should be moved into a central location to disable
13
- this error and allow the icon to be quickly replaced. What location to display in the error can be
14
- configured via the legacyIconPackages option.
15
-
16
- ## Examples
17
-
18
- This rule identifies usages of custom icons from `@atlaskit/icon` or `@atlaskit/icon/base`.
19
-
20
- ### Incorrect
21
-
22
- ```js
23
- import Icon from '@atlaskit/icon';
24
- ^^^^^^^^^^^^^^^^^ custom icon import
25
-
26
- <Icon label="Activity" glyph="...">
27
- ^^^^^^^^^^^^^^^^^^^^^^^ custom icon
28
- ```
29
-
30
- ### Correct
31
-
32
- ```js
33
- import AddIcon from '@atlaskit/icon/core/add';
34
-
35
- <AddIcon label="" />;
36
- ```
@@ -1,82 +0,0 @@
1
- # no-deprecated-apis
2
-
3
- Props across the Atlassian Design System can be deprecated when they are deemed no-longer fit for
4
- purporse or dangerous and risk effective use at scale.
5
-
6
- ## Examples
7
-
8
- Anything that can be used as props from Atlassian Design System components can be violations when
9
- marked as deprecated.
10
-
11
- ### Incorrect
12
-
13
- ```tsx
14
- <ButtonItem cssFn={cssFn()} />
15
- ^^^^
16
-
17
- <Drawer overrides={overrides} />
18
- ^^^^^^^^^
19
- ```
20
-
21
- ## Options
22
-
23
- The rule can take one option: `deprecatedConfig`, if not provided the rule will use an internal
24
- config. If provided the rule will use the passed in config instead.
25
-
26
- ### deprecatedConfig
27
-
28
- The following fields can be defined in the config:
29
-
30
- - `deprecatedProp`, which is the deprecated props. Each prop has the following fields:
31
- - `moduleSpecifier`, which is the module specifier of the package in which the prop was
32
- deprecated. For example: `@atlaskit/button`.
33
- - `namedSpecifier` **(optional)**, which is an array of named specifiers of the package in which
34
- the prop was deprecated. For example: `Button`.
35
- - `actionableVersion` **(optional)**, which is the version of the package in which the prop can be
36
- actioned on. For example: `1.0.0`.
37
-
38
- ```json
39
- {
40
- "cssFn": [
41
- {
42
- "moduleSpecifier": "@atlaskit/menu"
43
- }
44
- ]
45
- }
46
- ```
47
-
48
- ```js
49
- import { configs } from '@atlaskit/eslint-plugin-design-system';
50
-
51
- module.exports = {
52
- rules: {
53
- '@atlaskit/design-system/no-deprecated-api': [
54
- 'error',
55
- {
56
- deprecatedConfig: {
57
- cssFn: [
58
- {
59
- moduleSpecifier: '@atlaskit/menu',
60
- },
61
- ],
62
- },
63
- },
64
- ],
65
- },
66
- };
67
- ```
68
-
69
- The plugin also provides a `filterActionableDeprecations` util function that accepts the
70
- `deprecated APIs config` and your root `package.json` as params and will filter the default
71
- deprecated APIs config based on the package versions installed.
72
-
73
- ```js
74
- import { configs, filterActionableDeprecations } from '@atlaskit/eslint-plugin-design-system';
75
- import packageJson from './package.json';
76
-
77
- rules: {
78
- '@atlaskit/design-system/no-deprecated-api': ['error', {
79
- 'deprecatedConfig': filterActionableDeprecations(configs.deprecatedConfig, packageJson),
80
- }]
81
- }
82
- ```
@@ -1,30 +0,0 @@
1
- # no-deprecated-design-token-usage
2
-
3
- Using deprecated design tokens is dangerous as they will eventually be deleted after the sunset
4
- period. This rule helps you move to non-deprecated design tokens.
5
-
6
- ## Examples
7
-
8
- This rule will mark usage of deprecated design tokens as violations.
9
-
10
- ## Incorrect
11
-
12
- ```js
13
- import { token } from '@atlaskit/tokens';
14
-
15
- css({ color: token('i.am.deprecated') });
16
- ^^^^^^^^^^^^^^^
17
- css({ color: token('i.am.a.token') });
18
- ^^^^^^^^^^^^^
19
- ```
20
-
21
- ## Options
22
-
23
- It's recommended to set this rule to "warn" to allow for new and old tokens to exist side-by-side
24
- for the duration of the deprecation period and avoid big-bang migrations.
25
-
26
- Once the deprecation period is over for a design token it will be moved into `deleted` state at
27
- which point the counterpart of this rule `no-unsafe-design-token-usage` will mark violations as
28
- errors.
29
-
30
- Running `eslint --fix` will automatically apply replacement tokens if present.
@@ -1,66 +0,0 @@
1
- # no-deprecated-imports
2
-
3
- Packages across the Atlassian Design System can be deprecated when they are deemed no-longer fit for
4
- purporse or dangerous and risk effective use at scale.
5
-
6
- ## Examples
7
-
8
- This rule will mark usage of deprecated modules as violations.
9
-
10
- ### Incorrect
11
-
12
- ```ts
13
- import Item from '@atlaskit/item';
14
- ^^^^^^^^^^^^^^
15
- import GlobalNav from '@atlaskit/global-navigation';
16
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17
- ```
18
-
19
- ## Options
20
-
21
- The rule can take one option: `deprecatedConfig`, if not provided the rule will use an internal
22
- config. If provided the rule will use the passed in config instead.
23
-
24
- ### deprecatedConfig
25
-
26
- The following fields can be defined in the config:
27
-
28
- - `packagePath`, which is the name of the package. For example: `@atlaskit/navigation-next` and
29
- `@atlaskit/navigation`. With the package path as the key, you can either provide the values as:
30
- - `message` **(optional)**, the message to display when the deprecated packages path is used. For
31
- example: `multi-select is deprecated. Please use '@atlaskit/select' instead.` Or as:
32
- - `imports`, which is an array of named imports to be deprecated. Each named import has the
33
- following fields:
34
- - `importName`, which is the name of the import to be deprecated. For example: `assistive` and
35
- `visuallyHidden`.
36
- - `message` **(optional)**, which is the message to display when the deprecated import is used.
37
- For example:
38
- `The assistive mixin is deprecated. Please use `@atlaskit/visually-hidden` instead.`.
39
-
40
- ```json
41
- {
42
- "@atlaskit/navigation-next": {
43
- "message": "navigation-next is deprecated. Please use '@atlaskit/atlassian-navigation' instead."
44
- }
45
- }
46
- ```
47
-
48
- ```js
49
- import packageJson from './package.json';
50
-
51
- module.exports = {
52
- rules: {
53
- '@atlaskit/design-system/no-deprecated-imports': [
54
- 'error',
55
- {
56
- deprecatedConfig: {
57
- '@atlaskit/navigation-next': {
58
- message:
59
- "navigation-next is deprecated. Please use '@atlaskit/atlassian-navigation' instead.",
60
- },
61
- },
62
- },
63
- ],
64
- },
65
- };
66
- ```
@@ -1,149 +0,0 @@
1
- # no-direct-use-of-web-platform-drag-and-drop
2
-
3
- Block the usage of web platform drag and drop functionality directly. Use Pragmatic drag and drop.
4
-
5
- ## Rationale
6
-
7
- The web platform has powerful drag and drop functionality built in. However, it is hard to be
8
- successful with web platform drag and drop due to bugs, inconsistencies and usage friction. Rather
9
- than leveraging the web platform API directly, the rule enforces the usage of
10
- [Pragmatic drag and drop](https://atlassian.design/components/pragmatic-drag-and-drop), which allows
11
- people to easily and successfully leverage web platform drag and drop.
12
-
13
- ## Examples
14
-
15
- This rule marks direct usage of web platform drag events as violations.
16
-
17
- ### Incorrect
18
-
19
- Adding drag related event listeners on intrinsic `react` elements (eg `div`, `span`, `strong` and so
20
- on).
21
-
22
- ```tsx
23
- <div onDragStart={fn}>{children}</div>
24
- ^^^^^^^^^^^
25
- <div onDragEnter={fn}>{children}</div>
26
- ^^^^^^^^^^^
27
- <div onDragLeave={fn}>{children}</div>
28
- ^^^^^^^^^^^
29
- <div onDragOver={fn}>{children}</div>
30
- ^^^^^^^^^^^
31
- <div onDrag={fn}>{children}</div>
32
- ^^^^^^
33
- <div onDrop={fn}>{children}</div>
34
- ^^^^^^
35
- <div onDragEnd={fn}>{children}</div>
36
- ^^^^^^^^^
37
- ```
38
-
39
- Adding drag related event listeners on our `<Box>` primitive.
40
-
41
- ```tsx
42
- import { Box } from '@atlaskit/primitives';
43
-
44
- <Box onDragStart={fn}>{children}</Box>
45
- ^^^^^^^^^^^
46
- <Box onDragEnter={fn}>{children}</Box>
47
- ^^^^^^^^^^^
48
- <Box onDragLeave={fn}>{children}</Box>
49
- ^^^^^^^^^^^
50
- <Box onDragOver={fn}>{children}</Box>
51
- ^^^^^^^^^^^
52
- <Box onDrag={fn}>{children}</Box>
53
- ^^^^^^
54
- <Box onDrop={fn}>{children}</Box>
55
- ^^^^^^
56
- <Box onDragEnd={fn}>{children}</Box>
57
- ^^^^^^^^^
58
- ```
59
-
60
- Binding drag related events using `eventTarget.addEventListener()`
61
-
62
- ```ts
63
- window.addEventListener('dragstart', fn);
64
- ^^^^^^^^^^^
65
- window.addEventListener('dragenter', fn);
66
- ^^^^^^^^^^^
67
- window.addEventListener('dragleave', fn);
68
- ^^^^^^^^^^^
69
- window.addEventListener('dragover', fn);
70
- ^^^^^^^^^^
71
- window.addEventListener('drag', fn);
72
- ^^^^^^
73
- window.addEventListener('drop', fn);
74
- ^^^^^^
75
- window.addEventListener('dragend', fn);
76
- ^^^^^^^^^
77
- ```
78
-
79
- Binding drag related events using `bind()` from
80
- [bind-event-listener](https://github.com/alexreardon/bind-event-listener)
81
-
82
- ```ts
83
- import {bind} from 'bind-event-listener';
84
-
85
- bind(element, { type: 'dragstart', listener: fn });
86
- ^^^^^^^^^^^
87
- bind(element, { type: 'dragenter', listener: fn });
88
- ^^^^^^^^^^^
89
- bind(element, { type: 'dragleave', listener: fn });
90
- ^^^^^^^^^^^
91
- bind(element, { type: 'dragover', listener: fn });
92
- ^^^^^^^^^^
93
- bind(element, { type: 'drag', listener: fn });
94
- ^^^^^^
95
- bind(element, { type: 'drop', listener: fn });
96
- ^^^^^^
97
- bind(element, { type: 'dragend', listener: fn });
98
- ^^^^^^^^^
99
- ```
100
-
101
- Binding drag related events using `bindAll()` from
102
- [bind-event-listener](https://github.com/alexreardon/bind-event-listener)
103
-
104
- ```ts
105
- import {bindAll} from 'bind-event-listener';
106
-
107
- bindAll(window, [
108
- { type: 'dragstart', listener: fn },
109
- ^^^^^^^^^^
110
- { type: 'dragenter', listener: fn },
111
- ^^^^^^^^^^
112
- { type: 'dragleave', listener: fn },
113
- ^^^^^^^^^^
114
- { type: 'dragover', listener: fn },
115
- ^^^^^^^^^^
116
- { type: 'drag', listener: fn },
117
- ^^^^^^
118
- { type: 'drop', listener: fn },
119
- ^^^^^^
120
- { type: 'dragend', listener: fn },
121
- ^^^^^^^^^
122
- ]);
123
- ```
124
-
125
- ### Correct
126
-
127
- Leveraging Pragmatic drag and drop for web platform drag and drop.
128
-
129
- ```ts
130
- import { monitor } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
131
-
132
- monitor({
133
- onGenerateDragPreview: fn,
134
- onDragStart: fn,
135
- onDropTargetChange: fn,
136
- onDrag: fn,
137
- onDrop: fn,
138
- });
139
- ```
140
-
141
- > See the
142
- > [Pragmatic drag and drop documentation](https://atlassian.design/components/pragmatic-drag-and-drop)
143
- > for more information about it's usage.
144
-
145
- Using blocked JSX attributes on custom `react` components
146
-
147
- ```tsx
148
- <MyComponent onDragStart={fn}>
149
- ```
@@ -1,82 +0,0 @@
1
- # no-empty-styled-expression
2
-
3
- Disallows/discourages passing empty arguments to any `styled` expression when using a CSS-in-JS
4
- library, including `@atlaskit/css`, `@compiled/react`, Emotion, and `styled-components`.
5
-
6
- If Compiled is used in the file, passing an empty object or no object at all causes Compiled to
7
- build extra `div/span` elements, as opposed to simply using a `div`. This leads to reduced
8
- performance and is greatly discouraged. If a wrapper is necessary, opt to use a `div` or wrap it in
9
- the empty React fragment `<> <YourComponentHere></YourComponentHere> </>`.
10
-
11
- ## Examples
12
-
13
- ### Incorrect
14
-
15
- ```tsx
16
- const EmptyStyledExpression = styled.div();
17
-
18
- const EmptyStyledExpressionArgument = styled.div({});
19
-
20
- const EmptyStyledExpressionArgument = styled.div([]);
21
- ```
22
-
23
- ### Correct
24
-
25
- ```tsx
26
- const Wrapper = styled.div({
27
- backgroundColor: 'red',
28
- MyComponent: {
29
- backgroundColor: 'green',
30
- },
31
- });
32
- ```
33
-
34
- ## What to do instead?
35
-
36
- ### Use elements directly
37
-
38
- ```diff
39
- - const Wrapper = styled.div({});
40
-
41
- function App() {
42
- - return <Wrapper>hello world</Wrapper>;
43
- + return <div>hello world</div>;
44
- }
45
- ```
46
-
47
- ### Use a React fragment
48
-
49
- ```diff
50
- - const Wrapper = styled.div({});
51
-
52
- function App() {
53
- - return <Wrapper>hello world</Wrapper>;
54
- + return <>hello world</>;
55
- }
56
- ```
57
-
58
- ## Options
59
-
60
- ### importSources
61
-
62
- By default, this rule will check `styled` usages from:
63
-
64
- - `@atlaskit/css`
65
- - `@atlaskit/primitives`
66
- - `@compiled/react`
67
- - `@emotion/react`
68
- - `@emotion/core`
69
- - `@emotion/styled`
70
- - `styled-components`
71
-
72
- To change this list of libraries, you can define a custom set of `importSources`, which accepts an
73
- array of package names (strings).
74
-
75
- ```tsx
76
- // [{ importSources: ['other-lib'] }]
77
-
78
- import { styled } from 'other-lib';
79
-
80
- // Invalid!
81
- export const Component = styled.div({});
82
- ```
@@ -1,55 +0,0 @@
1
- # no-exported-css
2
-
3
- Disallows `css` export declarations that originate from a CSS-in-JS library, including
4
- `@atlaskit/css`, `@compiled/react`, Emotion, and `styled-components`.
5
-
6
- In Compiled (`@atlaskit/css` and `@compiled/react`), exporting `css` declarations may result in
7
- unexpected errors when imported, because its value will be `null` at runtime. Additionally,
8
- co-locating `css` definitions with their usage is considered best practice in order to improve code
9
- readability and build performance.
10
-
11
- ## Examples
12
-
13
- ### Incorrect
14
-
15
- ```tsx
16
- import { css } from '@compiled/react';
17
-
18
- export const styles = css({});
19
-
20
- export default css({});
21
- ```
22
-
23
- ### Correct
24
-
25
- ```tsx
26
- import { css } from '@compiled/react';
27
-
28
- const styles = css({});
29
- ```
30
-
31
- ## Options
32
-
33
- ### importSources
34
-
35
- By default, this rule will check `css` usages from:
36
-
37
- - `@atlaskit/css`
38
- - `@atlaskit/primitives`
39
- - `@compiled/react`
40
- - `@emotion/react`
41
- - `@emotion/core`
42
- - `@emotion/styled`
43
- - `styled-components`
44
-
45
- To change this list of libraries, you can define a custom set of `importSources`, which accepts an
46
- array of package names (strings).
47
-
48
- ```tsx
49
- // [{ importSources: ['other-lib'] }]
50
-
51
- import { css } from 'other-lib';
52
-
53
- // Invalid!
54
- export const styles = css({});
55
- ```
@@ -1,55 +0,0 @@
1
- # no-exported-keyframes
2
-
3
- Disallows `keyframes` export declarations that originate from a CSS-in-JS library, including
4
- `@atlaskit/css`, `@compiled/react`, Emotion, and `styled-components`.
5
-
6
- In Compiled (`@atlaskit/css` and `@compiled/react`), exporting `keyframes` declarations may result
7
- in unexpected errors when imported, because its value will be `null` at runtime. Additionally,
8
- co-locating `keyframes` definitions with their usage is considered best practice in order to improve
9
- code readability and build performance.
10
-
11
- ## Examples
12
-
13
- ### Incorrect
14
-
15
- ```tsx
16
- import { keyframes } from '@compiled/react';
17
-
18
- export const animation = keyframes({});
19
-
20
- export default keyframes({});
21
- ```
22
-
23
- ### Correct
24
-
25
- ```tsx
26
- import { keyframes } from '@compiled/react';
27
-
28
- const animation = keyframes({});
29
- ```
30
-
31
- ## Options
32
-
33
- ### importSources
34
-
35
- By default, this rule will check `keyframes` usages from:
36
-
37
- - `@atlaskit/css`
38
- - `@atlaskit/primitives`
39
- - `@compiled/react`
40
- - `@emotion/react`
41
- - `@emotion/core`
42
- - `@emotion/styled`
43
- - `styled-components`
44
-
45
- To change this list of libraries, you can define a custom set of `importSources`, which accepts an
46
- array of package names (strings).
47
-
48
- ```tsx
49
- // [{ importSources: ['other-lib'] }]
50
-
51
- import { keyframes } from 'other-lib';
52
-
53
- // Invalid!
54
- export const animation = keyframes({});
55
- ```
@@ -1,46 +0,0 @@
1
- # no-html-anchor
2
-
3
- Don't use native HTML anchors. The Atlassian Design System provides ready-made link components that
4
- include event tracking, automatic router configuration, ensure accessible implementations, and
5
- provide access to ADS styling features like design tokens.
6
-
7
- Use Atlassian Design System components such as the [Link](/components/link/) or
8
- [LinkButton](/components/button/link-button/) components when suitable. There may also be other
9
- components better-suited depending on the use case. If these components aren't suitable, use the
10
- [Anchor primitive](/components/primitives/anchor/) which helps you build custom links with Atlassian
11
- Design System styling.
12
-
13
- ## Examples
14
-
15
- This rule marks code as violations when it finds native HTML anchor elements.
16
-
17
- ### Incorrect
18
-
19
- ```jsx
20
- <a href="/">
21
- ^ Using a native HTML `<a>`
22
- Hello, World!
23
- </a>
24
-
25
- <div role="link" tabIndex="0" data-href="https://www.atlassian.com">
26
- ^^^^^^^^^^^ Using `role="link"` to create links
27
- Hello, World!
28
- </div>
29
-
30
- ```
31
-
32
- ### Correct
33
-
34
- ```jsx
35
- import Anchor from '@atlaskit/primitives/anchor';
36
-
37
- <Anchor href="/">Hello, World!</Anchor>;
38
-
39
- import Link from '@atlaskit/link';
40
-
41
- <Link href="/">Hello, World!</Link>;
42
-
43
- import { LinkButton } from '@atlaskit/button/new';
44
-
45
- <LinkButton href="/">Hello, World!</LinkButton>;
46
- ```