@atlaskit/eslint-plugin-ui-styling-standard 0.15.2 → 0.16.0

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 (95) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/constellation/index/migration-guide.mdx +309 -0
  3. package/constellation/index/overview.mdx +4 -0
  4. package/constellation/index/props.mdx +9 -5
  5. package/dist/types/rules/no-unsafe-selectors/constants.d.ts +1 -4
  6. package/index.js +9 -9
  7. package/package.json +3 -3
  8. package/scripts/codegen.tsx +223 -284
  9. package/src/rules/__tests__/utils/_tester.tsx +24 -24
  10. package/src/rules/atlaskit-theme/README.md +21 -19
  11. package/src/rules/atlaskit-theme/__tests__/test.ts +53 -53
  12. package/src/rules/atlaskit-theme/index.ts +107 -115
  13. package/src/rules/convert-props-syntax/README.md +32 -22
  14. package/src/rules/convert-props-syntax/__tests__/invalid.test.tsx +46 -46
  15. package/src/rules/convert-props-syntax/__tests__/rule.test.tsx +175 -175
  16. package/src/rules/convert-props-syntax/__tests__/type-annotations.test.tsx +52 -52
  17. package/src/rules/convert-props-syntax/__tests__/unusual-properties.test.tsx +33 -33
  18. package/src/rules/convert-props-syntax/index.tsx +356 -386
  19. package/src/rules/enforce-style-prop/README.md +21 -18
  20. package/src/rules/enforce-style-prop/__tests__/rule.test.tsx +90 -96
  21. package/src/rules/enforce-style-prop/index.tsx +144 -160
  22. package/src/rules/external-rules.tsx +163 -164
  23. package/src/rules/local-cx-xcss/README.md +10 -6
  24. package/src/rules/local-cx-xcss/__tests__/rule.test.tsx +26 -26
  25. package/src/rules/local-cx-xcss/index.tsx +46 -56
  26. package/src/rules/no-array-arguments/README.md +2 -1
  27. package/src/rules/no-array-arguments/__tests__/rule.test.tsx +37 -46
  28. package/src/rules/no-array-arguments/index.tsx +68 -69
  29. package/src/rules/no-classname-prop/README.md +7 -4
  30. package/src/rules/no-classname-prop/__tests__/rule.test.tsx +22 -22
  31. package/src/rules/no-classname-prop/index.tsx +25 -25
  32. package/src/rules/no-container-queries/README.md +11 -9
  33. package/src/rules/no-container-queries/__tests__/rule.test.tsx +47 -50
  34. package/src/rules/no-container-queries/index.tsx +75 -81
  35. package/src/rules/no-dynamic-styles/README.md +16 -19
  36. package/src/rules/no-dynamic-styles/__tests__/rule.test.tsx +58 -67
  37. package/src/rules/no-dynamic-styles/index.tsx +45 -48
  38. package/src/rules/no-exported-styles/README.md +17 -12
  39. package/src/rules/no-exported-styles/__tests__/rule.test.tsx +102 -111
  40. package/src/rules/no-exported-styles/index.tsx +36 -36
  41. package/src/rules/no-global-styles/README.md +15 -14
  42. package/src/rules/no-global-styles/__tests__/no-css-modules.test.tsx +28 -28
  43. package/src/rules/no-global-styles/__tests__/no-global-styles.test.tsx +37 -37
  44. package/src/rules/no-global-styles/index.tsx +59 -62
  45. package/src/rules/no-important-styles/README.md +5 -3
  46. package/src/rules/no-important-styles/__tests__/rule.test.tsx +66 -66
  47. package/src/rules/no-important-styles/index.tsx +49 -49
  48. package/src/rules/no-imported-style-values/README.md +23 -15
  49. package/src/rules/no-imported-style-values/__tests__/rule.test.tsx +123 -123
  50. package/src/rules/no-imported-style-values/index.tsx +116 -120
  51. package/src/rules/no-nested-selectors/README.md +15 -13
  52. package/src/rules/no-nested-selectors/__tests__/rule.test.tsx +128 -128
  53. package/src/rules/no-styled/README.md +14 -9
  54. package/src/rules/no-styled/__tests__/rule.test.tsx +31 -31
  55. package/src/rules/no-styled/index.tsx +34 -41
  56. package/src/rules/no-unsafe-selectors/README.md +103 -93
  57. package/src/rules/no-unsafe-selectors/__tests__/no-grouped-at-rules.test.tsx +21 -24
  58. package/src/rules/no-unsafe-selectors/__tests__/no-increased-specificity.test.tsx +44 -44
  59. package/src/rules/no-unsafe-selectors/__tests__/no-keyframes-at-rules.test.tsx +21 -21
  60. package/src/rules/no-unsafe-selectors/__tests__/no-legacy-pseudo-element-syntax.test.tsx +57 -57
  61. package/src/rules/no-unsafe-selectors/__tests__/no-restricted-at-rules.test.tsx +58 -58
  62. package/src/rules/no-unsafe-selectors/__tests__/no-restricted-pseudos.test.tsx +85 -85
  63. package/src/rules/no-unsafe-selectors/__tests__/no-selectors-object.test.tsx +12 -12
  64. package/src/rules/no-unsafe-selectors/__tests__/no-unparsable-selectors.test.tsx +23 -23
  65. package/src/rules/no-unsafe-selectors/__tests__/rule.test.tsx +114 -114
  66. package/src/rules/no-unsafe-selectors/constants.tsx +69 -77
  67. package/src/rules/no-unsafe-selectors/source-position-utils.tsx +38 -38
  68. package/src/rules/no-unsafe-selectors/walk-css-map.tsx +178 -184
  69. package/src/rules/no-unsafe-values/README.md +34 -40
  70. package/src/rules/no-unsafe-values/__tests__/no-array-values.test.tsx +13 -13
  71. package/src/rules/no-unsafe-values/__tests__/no-conditional-values.test.tsx +18 -18
  72. package/src/rules/no-unsafe-values/__tests__/no-dynamic-keys.test.tsx +104 -104
  73. package/src/rules/no-unsafe-values/__tests__/no-function-calls.test.tsx +128 -128
  74. package/src/rules/no-unsafe-values/__tests__/no-identifier-arguments.test.tsx +23 -23
  75. package/src/rules/no-unsafe-values/__tests__/no-object-access.test.tsx +38 -38
  76. package/src/rules/no-unsafe-values/__tests__/no-object-references.test.tsx +18 -18
  77. package/src/rules/no-unsafe-values/__tests__/no-spread-elements.test.tsx +18 -18
  78. package/src/rules/no-unsafe-values/__tests__/no-unsafe-values.test.tsx +28 -28
  79. package/src/rules/no-unsafe-values/__tests__/no-variables.test.tsx +47 -47
  80. package/src/rules/no-unsafe-values/index.tsx +76 -78
  81. package/src/rules/no-unsafe-values/messages.tsx +12 -12
  82. package/src/rules/no-unsafe-values/utils.tsx +370 -382
  83. package/src/rules/use-compiled/README.md +11 -8
  84. package/src/rules/use-compiled/__tests__/can-auto-fix.test.tsx +32 -32
  85. package/src/rules/use-compiled/__tests__/css.test.tsx +53 -53
  86. package/src/rules/use-compiled/__tests__/imports.test.tsx +90 -95
  87. package/src/rules/use-compiled/__tests__/keyframes.test.tsx +47 -47
  88. package/src/rules/use-compiled/__tests__/pragma.test.tsx +64 -64
  89. package/src/rules/use-compiled/__tests__/styled.test.tsx +53 -53
  90. package/src/rules/use-compiled/__tests__/use-compiled.test.tsx +10 -10
  91. package/src/rules/use-compiled/index.tsx +203 -226
  92. package/src/rules/use-compiled/is-safe.tsx +113 -117
  93. package/src/rules/use-compiled/utils.tsx +14 -18
  94. package/src/rules/utils/create-rule-with-typed-config.tsx +62 -63
  95. package/src/rules/utils/create-rule.tsx +3 -6
@@ -2,14 +2,14 @@ import { typescriptEslintTester } from '../../__tests__/utils/_tester';
2
2
  import rule from '../index';
3
3
 
4
4
  typescriptEslintTester.run(
5
- 'convert-props-syntax',
6
- // @ts-expect-error
7
- rule,
8
- {
9
- valid: [
10
- {
11
- name: 'ignores type annotation in props argument',
12
- code: `
5
+ 'convert-props-syntax',
6
+ // @ts-expect-error
7
+ rule,
8
+ {
9
+ valid: [
10
+ {
11
+ name: 'ignores type annotation in props argument',
12
+ code: `
13
13
  import styled from 'styled-components';
14
14
 
15
15
  type Props = {
@@ -22,12 +22,12 @@ typescriptEslintTester.run(
22
22
  backgroundColor: props.myBackground,
23
23
  }))
24
24
  `,
25
- },
26
- ],
27
- invalid: [
28
- {
29
- name: 'converts styled usages with type annotation on the outside',
30
- code: `
25
+ },
26
+ ],
27
+ invalid: [
28
+ {
29
+ name: 'converts styled usages with type annotation on the outside',
30
+ code: `
31
31
  import styled from 'styled-components';
32
32
 
33
33
  styled.div<{ color: string; backgroundColor: string; }>({
@@ -35,7 +35,7 @@ typescriptEslintTester.run(
35
35
  backgroundColor: ({ backgroundColor }) => backgroundColor,
36
36
  });
37
37
  `,
38
- output: `
38
+ output: `
39
39
  import styled from 'styled-components';
40
40
 
41
41
  styled.div<{ color: string; backgroundColor: string; }>((props) => ({
@@ -43,11 +43,11 @@ typescriptEslintTester.run(
43
43
  backgroundColor: props.backgroundColor,
44
44
  }));
45
45
  `,
46
- errors: [{ messageId: 'unsupported-prop-syntax' }],
47
- },
48
- {
49
- name: 'converts styled usages with type annotation on the outside (as a variable)',
50
- code: `
46
+ errors: [{ messageId: 'unsupported-prop-syntax' }],
47
+ },
48
+ {
49
+ name: 'converts styled usages with type annotation on the outside (as a variable)',
50
+ code: `
51
51
  import styled from 'styled-components';
52
52
 
53
53
  type Props = {
@@ -59,7 +59,7 @@ typescriptEslintTester.run(
59
59
  backgroundColor: ({ backgroundColor }) => backgroundColor,
60
60
  });
61
61
  `,
62
- output: `
62
+ output: `
63
63
  import styled from 'styled-components';
64
64
 
65
65
  type Props = {
@@ -71,11 +71,11 @@ typescriptEslintTester.run(
71
71
  backgroundColor: props.backgroundColor,
72
72
  }));
73
73
  `,
74
- errors: [{ messageId: 'unsupported-prop-syntax' }],
75
- },
76
- {
77
- name: 'disables autofixer when type annotation is inside props argument',
78
- code: `
74
+ errors: [{ messageId: 'unsupported-prop-syntax' }],
75
+ },
76
+ {
77
+ name: 'disables autofixer when type annotation is inside props argument',
78
+ code: `
79
79
  import styled from 'styled-components';
80
80
 
81
81
  type Props = {
@@ -88,15 +88,15 @@ typescriptEslintTester.run(
88
88
  backgroundColor: (props: Props) => props.backgroundColor,
89
89
  });
90
90
  `,
91
- errors: [
92
- {
93
- messageId: 'unsupported-prop-syntax-no-autofixer',
94
- },
95
- ],
96
- },
97
- {
98
- name: 'disables autofixer when type annotation is given for destructured props',
99
- code: `
91
+ errors: [
92
+ {
93
+ messageId: 'unsupported-prop-syntax-no-autofixer',
94
+ },
95
+ ],
96
+ },
97
+ {
98
+ name: 'disables autofixer when type annotation is given for destructured props',
99
+ code: `
100
100
  import styled from 'styled-components';
101
101
 
102
102
  type Props = {
@@ -109,15 +109,15 @@ typescriptEslintTester.run(
109
109
  backgroundColor: ({ backgroundColor }: Props) => backgroundColor,
110
110
  });
111
111
  `,
112
- errors: [
113
- {
114
- messageId: 'unsupported-prop-syntax-no-autofixer',
115
- },
116
- ],
117
- },
118
- {
119
- name: 'disables autofixer when type annotation is inside props within template literal',
120
- code: `
112
+ errors: [
113
+ {
114
+ messageId: 'unsupported-prop-syntax-no-autofixer',
115
+ },
116
+ ],
117
+ },
118
+ {
119
+ name: 'disables autofixer when type annotation is inside props within template literal',
120
+ code: `
121
121
  import styled from 'styled-components';
122
122
 
123
123
  interface ThumbnailProps {
@@ -129,12 +129,12 @@ typescriptEslintTester.run(
129
129
  backgroundSize: 'cover',
130
130
  });
131
131
  `,
132
- errors: [
133
- {
134
- messageId: 'unsupported-prop-syntax-no-autofixer',
135
- },
136
- ],
137
- },
138
- ],
139
- },
132
+ errors: [
133
+ {
134
+ messageId: 'unsupported-prop-syntax-no-autofixer',
135
+ },
136
+ ],
137
+ },
138
+ ],
139
+ },
140
140
  );
@@ -2,31 +2,31 @@ import { typescriptEslintTester } from '../../__tests__/utils/_tester';
2
2
  import rule from '../index';
3
3
 
4
4
  typescriptEslintTester.run(
5
- 'convert-props-syntax',
6
- // @ts-expect-error
7
- rule,
8
- {
9
- valid: [],
10
- invalid: [
11
- {
12
- name: 'disables autofixer for rest element in parameter',
13
- // Not sure if this would ever occur in a codebase, but we deliberately ignore it.
14
- code: `
5
+ 'convert-props-syntax',
6
+ // @ts-expect-error
7
+ rule,
8
+ {
9
+ valid: [],
10
+ invalid: [
11
+ {
12
+ name: 'disables autofixer for rest element in parameter',
13
+ // Not sure if this would ever occur in a codebase, but we deliberately ignore it.
14
+ code: `
15
15
  import styled from 'styled-components';
16
16
 
17
17
  styled.div({
18
18
  color: ({ ...restElement }) => restElement,
19
19
  });
20
20
  `,
21
- errors: [
22
- {
23
- messageId: 'unsupported-prop-syntax-no-autofixer',
24
- },
25
- ],
26
- },
27
- {
28
- name: 'disables autofixer for default value in parameter',
29
- code: `
21
+ errors: [
22
+ {
23
+ messageId: 'unsupported-prop-syntax-no-autofixer',
24
+ },
25
+ ],
26
+ },
27
+ {
28
+ name: 'disables autofixer for default value in parameter',
29
+ code: `
30
30
  import styled from 'styled-components';
31
31
 
32
32
  styled.div({
@@ -34,15 +34,15 @@ typescriptEslintTester.run(
34
34
  backgroundColor: ({ myColor = '#aaa' }) => myColor,
35
35
  });
36
36
  `,
37
- errors: [
38
- {
39
- messageId: 'unsupported-prop-syntax-no-autofixer',
40
- },
41
- ],
42
- },
43
- {
44
- name: 'applies autofixer for nested selector',
45
- code: `
37
+ errors: [
38
+ {
39
+ messageId: 'unsupported-prop-syntax-no-autofixer',
40
+ },
41
+ ],
42
+ },
43
+ {
44
+ name: 'applies autofixer for nested selector',
45
+ code: `
46
46
  import styled from 'styled-components';
47
47
 
48
48
  styled.div({
@@ -52,7 +52,7 @@ typescriptEslintTester.run(
52
52
  color: (props) => props.otherColor,
53
53
  });
54
54
  `,
55
- output: `
55
+ output: `
56
56
  import styled from 'styled-components';
57
57
 
58
58
  styled.div((props) => ({
@@ -62,8 +62,8 @@ typescriptEslintTester.run(
62
62
  color: props.otherColor,
63
63
  }));
64
64
  `,
65
- errors: [{ messageId: 'unsupported-prop-syntax' }],
66
- },
67
- ],
68
- },
65
+ errors: [{ messageId: 'unsupported-prop-syntax' }],
66
+ },
67
+ ],
68
+ },
69
69
  );