@atlaskit/eslint-plugin-ui-styling-standard 0.11.4 → 0.11.6

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 (59) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +33 -3
  3. package/constellation/atlaskit-theme/usage.mdx +113 -0
  4. package/constellation/convert-props-syntax/usage.mdx +32 -22
  5. package/constellation/enforce-style-prop/usage.mdx +21 -18
  6. package/constellation/index/overview.mdx +91 -76
  7. package/constellation/index/props.mdx +2 -9
  8. package/constellation/local-cx-xcss/usage.mdx +10 -6
  9. package/constellation/no-array-arguments/usage.mdx +10 -9
  10. package/constellation/no-classname-prop/usage.mdx +7 -4
  11. package/constellation/no-container-queries/usage.mdx +17 -15
  12. package/constellation/no-dynamic-styles/usage.mdx +26 -29
  13. package/constellation/no-exported-styles/usage.mdx +23 -18
  14. package/constellation/no-important-styles/usage.mdx +5 -3
  15. package/constellation/no-imported-style-values/usage.mdx +30 -22
  16. package/constellation/no-nested-selectors/usage.mdx +22 -20
  17. package/constellation/no-unsafe-values/usage.mdx +45 -51
  18. package/dist/cjs/index.codegen.js +1 -1
  19. package/dist/cjs/presets/all.codegen.js +2 -1
  20. package/dist/cjs/presets/recommended.codegen.js +2 -1
  21. package/dist/cjs/rules/atlaskit-theme/index.js +95 -0
  22. package/dist/cjs/rules/enforce-style-prop/index.js +39 -26
  23. package/dist/cjs/rules/index.codegen.js +3 -1
  24. package/dist/es2019/index.codegen.js +1 -1
  25. package/dist/es2019/presets/all.codegen.js +2 -1
  26. package/dist/es2019/presets/recommended.codegen.js +2 -1
  27. package/dist/es2019/rules/atlaskit-theme/index.js +85 -0
  28. package/dist/es2019/rules/enforce-style-prop/index.js +34 -19
  29. package/dist/es2019/rules/index.codegen.js +3 -1
  30. package/dist/esm/index.codegen.js +1 -1
  31. package/dist/esm/presets/all.codegen.js +2 -1
  32. package/dist/esm/presets/recommended.codegen.js +2 -1
  33. package/dist/esm/rules/atlaskit-theme/index.js +89 -0
  34. package/dist/esm/rules/enforce-style-prop/index.js +39 -26
  35. package/dist/esm/rules/index.codegen.js +3 -1
  36. package/dist/types/index.codegen.d.ts +2 -0
  37. package/dist/types/presets/all.codegen.d.ts +2 -1
  38. package/dist/types/presets/recommended.codegen.d.ts +2 -1
  39. package/dist/types/rules/atlaskit-theme/index.d.ts +3 -0
  40. package/dist/types/rules/index.codegen.d.ts +1 -0
  41. package/dist/types-ts4.5/index.codegen.d.ts +2 -0
  42. package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -1
  43. package/dist/types-ts4.5/presets/recommended.codegen.d.ts +2 -1
  44. package/dist/types-ts4.5/rules/atlaskit-theme/index.d.ts +3 -0
  45. package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
  46. package/package.json +3 -3
  47. package/scripts/codegen.tsx +3 -10
  48. package/src/index.codegen.tsx +3 -3
  49. package/src/presets/all.codegen.tsx +66 -69
  50. package/src/presets/recommended.codegen.tsx +66 -69
  51. package/src/rules/atlaskit-theme/README.md +109 -0
  52. package/src/rules/atlaskit-theme/__tests__/test.ts +122 -0
  53. package/src/rules/atlaskit-theme/index.ts +136 -0
  54. package/src/rules/enforce-style-prop/__tests__/rule.test.tsx +18 -0
  55. package/src/rules/enforce-style-prop/index.tsx +42 -23
  56. package/src/rules/index.codegen.tsx +15 -13
  57. package/src/rules/no-exported-styles/index.tsx +1 -1
  58. package/src/rules/no-imported-style-values/index.tsx +1 -1
  59. package/tsconfig.app.json +3 -0
@@ -1,10 +1,14 @@
1
1
  # local-cx-xcss
2
2
 
3
- This rule ensures the `cx()` function is only used within the `xcss` prop. This aids tracking what styles are applied to a jsx element.
3
+ This rule ensures the `cx()` function is only used within the `xcss` prop. This aids tracking what
4
+ styles are applied to a jsx element.
4
5
 
5
6
  The `cx` function is checked only if it is imported from `@compiled/react` or `@atlaskit/css`.
6
7
 
7
- Passing arguments to the `cx()` function is how you compose styles (combine more than one set of styles together) with XCSS. This is a workaround for the more conventional array syntax (e.g. [in Emotion](https://emotion.sh/docs/composition)) `<div xcss={[style1, style2]} />` not giving robust enough type checking.
8
+ Passing arguments to the `cx()` function is how you compose styles (combine more than one set of
9
+ styles together) with XCSS. This is a workaround for the more conventional array syntax (e.g.
10
+ [in Emotion](https://emotion.sh/docs/composition)) `<div xcss={[style1, style2]} />` not giving
11
+ robust enough type checking.
8
12
 
9
13
  ## Examples
10
14
 
@@ -14,8 +18,8 @@ Passing arguments to the `cx()` function is how you compose styles (combine more
14
18
  import { cx, cssMap } from '@compiled/react';
15
19
 
16
20
  const styles = cssMap({
17
- text: { color: 'red' },
18
- bg: { background: 'blue' },
21
+ text: { color: 'red' },
22
+ bg: { background: 'blue' },
19
23
  });
20
24
 
21
25
  const joinedStyles = cx(styles.text, styles.bg);
@@ -29,8 +33,8 @@ const joinedStyles = cx(styles.text, styles.bg);
29
33
  import { cx, cssMap } from '@compiled/react';
30
34
 
31
35
  const styles = cssMap({
32
- text: { color: 'red' },
33
- bg: { background: 'blue' },
36
+ text: { color: 'red' },
37
+ bg: { background: 'blue' },
34
38
  });
35
39
 
36
40
  <Button xcss={cx(styles.text, styles.bg)} />;
@@ -34,12 +34,13 @@ const styles = css({ width: 100 }, ...items);
34
34
 
35
35
  By default, this rule will check `css` usages from:
36
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 array of package names (strings).
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).
@@ -2,7 +2,9 @@
2
2
 
3
3
  This rule prevents usage of the `className` prop in JSX.
4
4
 
5
- Avoid `className` because it invites the use of unsafe global styles and is impossible to determine via local tooling. Use props for configuration and typical CSS-in-JS for styling or `xcss` for bounded overrides.
5
+ Avoid `className` because it invites the use of unsafe global styles and is impossible to determine
6
+ via local tooling. Use props for configuration and typical CSS-in-JS for styling or `xcss` for
7
+ bounded overrides.
6
8
 
7
9
  ## Examples
8
10
 
@@ -32,7 +34,8 @@ import { css } from '@compiled/react';
32
34
 
33
35
  ### What if I'm using `className` to target elements with JavaScript?
34
36
 
35
- There are some cases where a selector is required to integrate with a 3rd party library,
36
- such as legacy code using jQuery.
37
+ There are some cases where a selector is required to integrate with a 3rd party library, such as
38
+ legacy code using jQuery.
37
39
 
38
- Use a `ref` if possible. Otherwise, if you _must_ have a selector, use a `data-*` attribute that gives enough context and is unique enough, for example `data-editor-table-target="true"`.
40
+ Use a `ref` if possible. Otherwise, if you _must_ have a selector, use a `data-*` attribute that
41
+ gives enough context and is unique enough, for example `data-editor-table-target="true"`.
@@ -2,7 +2,8 @@
2
2
 
3
3
  This rule prevents the usage of the `@container` query in style declarations.
4
4
 
5
- Container queries break the rules of scope and aren’t guaranteed to be deterministic or type safe and isn’t fully supported across our frontend tech stacks.
5
+ Container queries break the rules of scope and aren’t guaranteed to be deterministic or type safe
6
+ and isn’t fully supported across our frontend tech stacks.
6
7
 
7
8
  We suggest you explore the use alternatives such as client JavaScript-based APIs or media queries.
8
9
 
@@ -14,11 +15,11 @@ We suggest you explore the use alternatives such as client JavaScript-based APIs
14
15
  import { css } from '@compiled/react';
15
16
 
16
17
  const styles = css({
17
- '@container (width > 400px)': {
18
- h2: {
19
- fontSize: '1.5rem',
18
+ '@container (width > 400px)': {
19
+ h2: {
20
+ fontSize: '1.5rem',
21
+ },
20
22
  },
21
- },
22
23
  });
23
24
  ```
24
25
 
@@ -28,8 +29,8 @@ const styles = css({
28
29
  import { css } from '@compiled/react';
29
30
 
30
31
  const containerStyles = css({
31
- display: 'flex',
32
- flexDirection: 'column',
32
+ display: 'flex',
33
+ flexDirection: 'column',
33
34
  });
34
35
  ```
35
36
 
@@ -39,12 +40,13 @@ const containerStyles = css({
39
40
 
40
41
  By default, this rule will check `css` usages from:
41
42
 
42
- - `@atlaskit/css`
43
- - `@atlaskit/primitives`
44
- - `@compiled/react`
45
- - `@emotion/react`
46
- - `@emotion/core`
47
- - `@emotion/styled`
48
- - `styled-components`
43
+ - `@atlaskit/css`
44
+ - `@atlaskit/primitives`
45
+ - `@compiled/react`
46
+ - `@emotion/react`
47
+ - `@emotion/core`
48
+ - `@emotion/styled`
49
+ - `styled-components`
49
50
 
50
- To change this list of libraries, you can define a custom set of `importSources`, which accepts an array of package names (strings).
51
+ To change this list of libraries, you can define a custom set of `importSources`, which accepts an
52
+ array of package names (strings).
@@ -4,9 +4,9 @@ This rule prevents the use of dynamic styles (function expressions) in style dec
4
4
 
5
5
  This ensures that style declarations:
6
6
 
7
- - are statically analyzable
8
- - can be efficiently extracted into atomic CSS
9
- - are more readable, deterministic, and thus easier to maintain
7
+ - are statically analyzable
8
+ - can be efficiently extracted into atomic CSS
9
+ - are more readable, deterministic, and thus easier to maintain
10
10
 
11
11
  ## Examples
12
12
 
@@ -16,7 +16,7 @@ This ensures that style declarations:
16
16
  import { styled } from '@compiled/react';
17
17
 
18
18
  const Component = styled.div<{ width: number }>((props) => ({
19
- width: props.width,
19
+ width: props.width,
20
20
  }));
21
21
  ```
22
22
 
@@ -24,7 +24,7 @@ const Component = styled.div<{ width: number }>((props) => ({
24
24
  import styled from 'styled-components';
25
25
 
26
26
  const Component = styled.div<{ width: number }>({
27
- width: (props) => props.width,
27
+ width: (props) => props.width,
28
28
  });
29
29
  ```
30
30
 
@@ -32,8 +32,7 @@ const Component = styled.div<{ width: number }>({
32
32
  import styled from 'styled-components';
33
33
 
34
34
  const Container = styled.div<hasPadding>({
35
- padding: ({ hasPadding }) =>
36
- hasPadding ? token('space.100', '8px') : token('space.0', '0px'),
35
+ padding: ({ hasPadding }) => (hasPadding ? token('space.100', '8px') : token('space.0', '0px')),
37
36
  });
38
37
  ```
39
38
 
@@ -41,8 +40,8 @@ const Container = styled.div<hasPadding>({
41
40
 
42
41
  **Flags**
43
42
 
44
- If you have a style that is on/off depending on a prop,
45
- use the `css` prop to conditionally apply it.
43
+ If you have a style that is on/off depending on a prop, use the `css` prop to conditionally apply
44
+ it.
46
45
 
47
46
  ```tsx
48
47
  import { css } from '@compiled/react';
@@ -51,14 +50,14 @@ const baseStyles = css({ padding: token('space.0') });
51
50
  const hasPaddingStyles = css({ padding: token('space.100') });
52
51
 
53
52
  const Container = ({ hasPadding = false }: { hasPadding?: boolean }) => {
54
- return <div css={[baseStyles, hasPadding && hasPaddingStyles]} />;
53
+ return <div css={[baseStyles, hasPadding && hasPaddingStyles]} />;
55
54
  };
56
55
  ```
57
56
 
58
57
  **Variants**
59
58
 
60
- If you have variants which are known ahead of time,
61
- use `cssMap` to define them and the `css` prop to conditionally apply it.
59
+ If you have variants which are known ahead of time, use `cssMap` to define them and the `css` prop
60
+ to conditionally apply it.
62
61
 
63
62
  ```tsx
64
63
  import { css } from '@compiled/react';
@@ -82,8 +81,7 @@ const Wrapper = ({ appearance = 'primary' }: { appearance?: 'primary' | 'error'
82
81
 
83
82
  **Dynamic values**
84
83
 
85
- If you have styles which are truly dynamic,
86
- use the `style` prop.
84
+ If you have styles which are truly dynamic, use the `style` prop.
87
85
 
88
86
  This approach should be used as a last resort.
89
87
 
@@ -91,7 +89,7 @@ This approach should be used as a last resort.
91
89
  import { css } from '@compiled/react';
92
90
 
93
91
  const Component = ({ width }: { width: number }) => {
94
- return <div style={{ width }} />;
92
+ return <div style={{ width }} />;
95
93
  };
96
94
  ```
97
95
 
@@ -99,15 +97,13 @@ const Component = ({ width }: { width: number }) => {
99
97
  import { css } from '@compiled/react';
100
98
 
101
99
  const containerStyles = css({
102
- '::before': {
103
- width: 'var(--ak-example-width)',
104
- },
100
+ '::before': {
101
+ width: 'var(--ak-example-width)',
102
+ },
105
103
  });
106
104
 
107
105
  function Example({ width }: { width: number }) {
108
- return (
109
- <div css={containerStyles} style={{ '--ak-example-width': `${width}px` }} />
110
- );
106
+ return <div css={containerStyles} style={{ '--ak-example-width': `${width}px` }} />;
111
107
  }
112
108
  ```
113
109
 
@@ -117,12 +113,13 @@ function Example({ width }: { width: number }) {
117
113
 
118
114
  By default, this rule will check usages from:
119
115
 
120
- - `@atlaskit/css`
121
- - `@atlaskit/primitives`
122
- - `@compiled/react`
123
- - `@emotion/react`
124
- - `@emotion/core`
125
- - `@emotion/styled`
126
- - `styled-components`
116
+ - `@atlaskit/css`
117
+ - `@atlaskit/primitives`
118
+ - `@compiled/react`
119
+ - `@emotion/react`
120
+ - `@emotion/core`
121
+ - `@emotion/styled`
122
+ - `styled-components`
127
123
 
128
- To change this list of libraries, you can define a custom set of `importSources`, which accepts an array of package names (strings).
124
+ To change this list of libraries, you can define a custom set of `importSources`, which accepts an
125
+ array of package names (strings).
@@ -2,7 +2,9 @@
2
2
 
3
3
  This rule disallows exports of `css`, `cssMap`, `keyframes`, `styled`, `xcss` styles.
4
4
 
5
- Exporting style declarations from these libraries may result in unexpected errors when imported, because its value will be null at runtime. Additionally, co-locating style definitions with their usage is considered best practice in order to improve code readability and build performance.
5
+ Exporting style declarations from these libraries may result in unexpected errors when imported,
6
+ because its value will be null at runtime. Additionally, co-locating style definitions with their
7
+ usage is considered best practice in order to improve code readability and build performance.
6
8
 
7
9
  ## Examples
8
10
 
@@ -24,12 +26,13 @@ export const animation = keyframes({});
24
26
  export default keyframes({});
25
27
  ```
26
28
 
27
- Avoid exporting any style-like objects or values for consumption as well as these will violate our `no-imported-style-values` rule which blocks consumption of imported styles.
29
+ Avoid exporting any style-like objects or values for consumption as well as these will violate our
30
+ `no-imported-style-values` rule which blocks consumption of imported styles.
28
31
 
29
32
  ```js
30
33
  export default {
31
- color: 'red',
32
- margin: '0px',
34
+ color: 'red',
35
+ margin: '0px',
33
36
  };
34
37
  ```
35
38
 
@@ -37,15 +40,15 @@ export default {
37
40
  import { css } from '@compiled/react';
38
41
 
39
42
  const color = css({
40
- /* */
43
+ /* */
41
44
  });
42
45
 
43
46
  const styles = {
44
- primary: {
45
- text: {
46
- color,
47
+ primary: {
48
+ text: {
49
+ color,
50
+ },
47
51
  },
48
- },
49
52
  };
50
53
 
51
54
  export default styles.primary.text.color;
@@ -53,7 +56,8 @@ export default styles.primary.text.color;
53
56
 
54
57
  ### Correct
55
58
 
56
- Co-locate your styles next to your components to improve code readability, linting, and build performance.
59
+ Co-locate your styles next to your components to improve code readability, linting, and build
60
+ performance.
57
61
 
58
62
  ```js
59
63
  import { css } from '@compiled/react';
@@ -76,12 +80,13 @@ export const Component = ({ children }) => <div css={styles}>{children}></div>;
76
80
 
77
81
  By default, this rule will check `css` usages from:
78
82
 
79
- - `@atlaskit/css`
80
- - `@atlaskit/primitives`
81
- - `@compiled/react`
82
- - `@emotion/react`
83
- - `@emotion/core`
84
- - `@emotion/styled`
85
- - `styled-components`
83
+ - `@atlaskit/css`
84
+ - `@atlaskit/primitives`
85
+ - `@compiled/react`
86
+ - `@emotion/react`
87
+ - `@emotion/core`
88
+ - `@emotion/styled`
89
+ - `styled-components`
86
90
 
87
- To change this list of libraries, you can define a custom set of `importSources`, which accepts an array of package names (strings).
91
+ To change this list of libraries, you can define a custom set of `importSources`, which accepts an
92
+ array of package names (strings).
@@ -2,7 +2,9 @@
2
2
 
3
3
  This rule prevents the usage of the `!important` flag in style declarations.
4
4
 
5
- Properly composed styles will never need an `!important` flag. It is used to override specificity when working across different scopes, and the UI Styling Standard enforces styles with minimal scope.
5
+ Properly composed styles will never need an `!important` flag. It is used to override specificity
6
+ when working across different scopes, and the UI Styling Standard enforces styles with minimal
7
+ scope.
6
8
 
7
9
  The use of `!important` is a code smell and greatly impacts readability and determinism.
8
10
 
@@ -14,7 +16,7 @@ The use of `!important` is a code smell and greatly impacts readability and dete
14
16
  import { css } from '@compiled/react';
15
17
 
16
18
  const styles = css({
17
- color: 'red!important',
19
+ color: 'red!important',
18
20
  });
19
21
  ```
20
22
 
@@ -24,6 +26,6 @@ const styles = css({
24
26
  import { css } from '@compiled/react';
25
27
 
26
28
  const styles = css({
27
- color: 'red',
29
+ color: 'red',
28
30
  });
29
31
  ```
@@ -1,8 +1,12 @@
1
1
  # no-imported-style-values
2
2
 
3
- This rule disallows using imported style values in `css`, `cssMap`, `styled`, `keyframes` and `xcss` calls.
3
+ This rule disallows using imported style values in `css`, `cssMap`, `styled`, `keyframes` and `xcss`
4
+ calls.
4
5
 
5
- Importing style values may result in unexpected errors when used in these APIs, because its value will be null at runtime when using `@compiled/react`. Additionally, co-locating style definitions with their usage is considered best practice in order to improve code readability and build performance.
6
+ Importing style values may result in unexpected errors when used in these APIs, because its value
7
+ will be null at runtime when using `@compiled/react`. Additionally, co-locating style definitions
8
+ with their usage is considered best practice in order to improve code readability and build
9
+ performance.
6
10
 
7
11
  ## Examples
8
12
 
@@ -13,8 +17,8 @@ import { css } from '@compiled/react';
13
17
  import { colors, getColor } from '@mui/theme';
14
18
 
15
19
  const styles = css({
16
- [colorKey]: getColor('red'),
17
- background: colors['red'],
20
+ [colorKey]: getColor('red'),
21
+ background: colors['red'],
18
22
  });
19
23
  ```
20
24
 
@@ -26,10 +30,10 @@ import { ff } from '@atlaskit/ff';
26
30
  const sharedObject = { padding: 0 };
27
31
 
28
32
  const styles = css({
29
- ...cssShared,
30
- ...sharedObject,
31
- height: `${HEIGHT}px`,
32
- width: ff('…') ? `${HEIGHT}px` : undefined,
33
+ ...cssShared,
34
+ ...sharedObject,
35
+ height: `${HEIGHT}px`,
36
+ width: ff('…') ? `${HEIGHT}px` : undefined,
33
37
  });
34
38
  ```
35
39
 
@@ -40,7 +44,7 @@ import { css } from '@compiled/react';
40
44
  import { buttonStyles } from '../shared';
41
45
 
42
46
  const styles = css({
43
- color: 'red',
47
+ color: 'red',
44
48
  });
45
49
 
46
50
  export default () => <div css={[styles, buttonStyles]} />;
@@ -56,15 +60,16 @@ export default () => <div style={{ width: importedWidth }} />;
56
60
 
57
61
  ### Correct
58
62
 
59
- Co-locate your styles next to your components to improve code readability, linting, and build performance.
63
+ Co-locate your styles next to your components to improve code readability, linting, and build
64
+ performance.
60
65
 
61
66
  ```js
62
67
  import { css } from '@compiled/react';
63
68
  import { token } from '@atlaskit/tokens';
64
69
 
65
70
  const styles = css({
66
- color: 'red',
67
- padding: token('space.150'),
71
+ color: 'red',
72
+ padding: token('space.150'),
68
73
  });
69
74
  export const Component = ({ children }) => <div css={styles}>{children}></div>;
70
75
  ```
@@ -83,7 +88,8 @@ export const Component = ({ children }) => <div css={styles}>{children}></div>;
83
88
 
84
89
  Use this to allow specified imports as dynamic keys, in addition to the built-in allow-list.
85
90
 
86
- Each value should be a two-element array. The first item is the entrypoint, and the second item is a named export.
91
+ Each value should be a two-element array. The first item is the entrypoint, and the second item is a
92
+ named export.
87
93
 
88
94
  Default imports are not supported.
89
95
 
@@ -109,7 +115,8 @@ Default imports are not supported.
109
115
 
110
116
  Use this to allow specific functions to be called, in addition to the built-in allow-list.
111
117
 
112
- Each value should be a two-element array. The first item is the entrypoint, and the second item is a named export.
118
+ Each value should be a two-element array. The first item is the entrypoint, and the second item is a
119
+ named export.
113
120
 
114
121
  Default imports are not currently supported.
115
122
 
@@ -135,12 +142,13 @@ Default imports are not currently supported.
135
142
 
136
143
  By default, this rule will check `css` usages from:
137
144
 
138
- - `@atlaskit/css`
139
- - `@atlaskit/primitives`
140
- - `@compiled/react`
141
- - `@emotion/react`
142
- - `@emotion/core`
143
- - `@emotion/styled`
144
- - `styled-components`
145
+ - `@atlaskit/css`
146
+ - `@atlaskit/primitives`
147
+ - `@compiled/react`
148
+ - `@emotion/react`
149
+ - `@emotion/core`
150
+ - `@emotion/styled`
151
+ - `styled-components`
145
152
 
146
- To change this list of libraries, you can define a custom set of `importSources`, which accepts an array of package names (strings).
153
+ To change this list of libraries, you can define a custom set of `importSources`, which accepts an
154
+ array of package names (strings).
@@ -1,6 +1,7 @@
1
1
  # no-nested-selectors
2
2
 
3
- This rule prevents the usage of the nested selectors in style declarations. Avoid setting styles for any child elements or elements that require context from other elements.
3
+ This rule prevents the usage of the nested selectors in style declarations. Avoid setting styles for
4
+ any child elements or elements that require context from other elements.
4
5
 
5
6
  ## Examples
6
7
 
@@ -9,27 +10,27 @@ This rule prevents the usage of the nested selectors in style declarations. Avoi
9
10
  ```js
10
11
  import { css } from '@compiled/react';
11
12
  const styles = css({
12
- h2: {
13
- fontSize: '1.5rem',
14
- },
13
+ h2: {
14
+ fontSize: '1.5rem',
15
+ },
15
16
  });
16
17
  ```
17
18
 
18
19
  ```js
19
20
  import { styled } from '@compiled/react';
20
21
  const Component = styled.div({
21
- '*': {
22
- padding: 0,
23
- },
22
+ '*': {
23
+ padding: 0,
24
+ },
24
25
  });
25
26
  ```
26
27
 
27
28
  ```js
28
29
  import { styled } from '@compiled/react';
29
30
  const Component = styled.div({
30
- '.myclass': {
31
- padding: 0,
32
- },
31
+ '.myclass': {
32
+ padding: 0,
33
+ },
33
34
  });
34
35
  ```
35
36
 
@@ -38,8 +39,8 @@ const Component = styled.div({
38
39
  ```js
39
40
  import { css } from '@compiled/react';
40
41
  const styles = css({
41
- display: 'flex',
42
- flexDirection: 'column',
42
+ display: 'flex',
43
+ flexDirection: 'column',
43
44
  });
44
45
  ```
45
46
 
@@ -49,12 +50,13 @@ const styles = css({
49
50
 
50
51
  By default, this rule will check `css` usages from:
51
52
 
52
- - `@atlaskit/css`
53
- - `@atlaskit/primitives`
54
- - `@compiled/react`
55
- - `@emotion/react`
56
- - `@emotion/core`
57
- - `@emotion/styled`
58
- - `styled-components`
53
+ - `@atlaskit/css`
54
+ - `@atlaskit/primitives`
55
+ - `@compiled/react`
56
+ - `@emotion/react`
57
+ - `@emotion/core`
58
+ - `@emotion/styled`
59
+ - `styled-components`
59
60
 
60
- To change this list of libraries, you can define a custom set of `importSources`, which accepts an array of package names (strings).
61
+ To change this list of libraries, you can define a custom set of `importSources`, which accepts an
62
+ array of package names (strings).