@atlaskit/eslint-plugin-ui-styling-standard 0.15.2 → 0.16.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 +17 -0
- package/constellation/consistent-css-prop-usage/usage.mdx +3 -1
- package/constellation/index/migration-guide.mdx +309 -0
- package/constellation/index/overview.mdx +4 -0
- package/constellation/index/props.mdx +9 -5
- package/constellation/no-css-tagged-template-expression/usage.mdx +5 -2
- package/constellation/no-empty-styled-expression/usage.mdx +5 -2
- package/constellation/no-exported-css/usage.mdx +5 -2
- package/constellation/no-exported-keyframes/usage.mdx +5 -2
- package/constellation/no-invalid-css-map/usage.mdx +5 -2
- package/constellation/no-js-xcss/usage.mdx +3 -1
- package/constellation/no-keyframes-tagged-template-expression/usage.mdx +5 -2
- package/constellation/no-styled-tagged-template-expression/usage.mdx +5 -2
- package/constellation/no-suppress-xcss/usage.mdx +6 -3
- package/dist/types/rules/no-unsafe-selectors/constants.d.ts +1 -4
- package/index.js +9 -9
- package/package.json +3 -3
- package/scripts/codegen.tsx +223 -284
- package/src/rules/__tests__/utils/_tester.tsx +24 -24
- package/src/rules/atlaskit-theme/README.md +21 -19
- package/src/rules/atlaskit-theme/__tests__/test.ts +53 -53
- package/src/rules/atlaskit-theme/index.ts +107 -115
- package/src/rules/convert-props-syntax/README.md +32 -22
- package/src/rules/convert-props-syntax/__tests__/invalid.test.tsx +46 -46
- package/src/rules/convert-props-syntax/__tests__/rule.test.tsx +175 -175
- package/src/rules/convert-props-syntax/__tests__/type-annotations.test.tsx +52 -52
- package/src/rules/convert-props-syntax/__tests__/unusual-properties.test.tsx +33 -33
- package/src/rules/convert-props-syntax/index.tsx +356 -386
- package/src/rules/enforce-style-prop/README.md +21 -18
- package/src/rules/enforce-style-prop/__tests__/rule.test.tsx +90 -96
- package/src/rules/enforce-style-prop/index.tsx +144 -160
- package/src/rules/external-rules.tsx +163 -164
- package/src/rules/local-cx-xcss/README.md +10 -6
- package/src/rules/local-cx-xcss/__tests__/rule.test.tsx +26 -26
- package/src/rules/local-cx-xcss/index.tsx +46 -56
- package/src/rules/no-array-arguments/README.md +2 -1
- package/src/rules/no-array-arguments/__tests__/rule.test.tsx +37 -46
- package/src/rules/no-array-arguments/index.tsx +68 -69
- package/src/rules/no-classname-prop/README.md +7 -4
- package/src/rules/no-classname-prop/__tests__/rule.test.tsx +22 -22
- package/src/rules/no-classname-prop/index.tsx +25 -25
- package/src/rules/no-container-queries/README.md +11 -9
- package/src/rules/no-container-queries/__tests__/rule.test.tsx +47 -50
- package/src/rules/no-container-queries/index.tsx +75 -81
- package/src/rules/no-dynamic-styles/README.md +16 -19
- package/src/rules/no-dynamic-styles/__tests__/rule.test.tsx +58 -67
- package/src/rules/no-dynamic-styles/index.tsx +45 -48
- package/src/rules/no-exported-styles/README.md +17 -12
- package/src/rules/no-exported-styles/__tests__/rule.test.tsx +102 -111
- package/src/rules/no-exported-styles/index.tsx +36 -36
- package/src/rules/no-global-styles/README.md +15 -14
- package/src/rules/no-global-styles/__tests__/no-css-modules.test.tsx +28 -28
- package/src/rules/no-global-styles/__tests__/no-global-styles.test.tsx +37 -37
- package/src/rules/no-global-styles/index.tsx +59 -62
- package/src/rules/no-important-styles/README.md +5 -3
- package/src/rules/no-important-styles/__tests__/rule.test.tsx +66 -66
- package/src/rules/no-important-styles/index.tsx +49 -49
- package/src/rules/no-imported-style-values/README.md +23 -15
- package/src/rules/no-imported-style-values/__tests__/rule.test.tsx +123 -123
- package/src/rules/no-imported-style-values/index.tsx +116 -120
- package/src/rules/no-nested-selectors/README.md +15 -13
- package/src/rules/no-nested-selectors/__tests__/rule.test.tsx +141 -128
- package/src/rules/no-styled/README.md +14 -9
- package/src/rules/no-styled/__tests__/rule.test.tsx +31 -31
- package/src/rules/no-styled/index.tsx +34 -41
- package/src/rules/no-unsafe-selectors/README.md +103 -93
- package/src/rules/no-unsafe-selectors/__tests__/no-grouped-at-rules.test.tsx +21 -24
- package/src/rules/no-unsafe-selectors/__tests__/no-increased-specificity.test.tsx +44 -44
- package/src/rules/no-unsafe-selectors/__tests__/no-keyframes-at-rules.test.tsx +21 -21
- package/src/rules/no-unsafe-selectors/__tests__/no-legacy-pseudo-element-syntax.test.tsx +57 -57
- package/src/rules/no-unsafe-selectors/__tests__/no-restricted-at-rules.test.tsx +58 -58
- package/src/rules/no-unsafe-selectors/__tests__/no-restricted-pseudos.test.tsx +85 -85
- package/src/rules/no-unsafe-selectors/__tests__/no-selectors-object.test.tsx +12 -12
- package/src/rules/no-unsafe-selectors/__tests__/no-unparsable-selectors.test.tsx +23 -23
- package/src/rules/no-unsafe-selectors/__tests__/rule.test.tsx +133 -114
- package/src/rules/no-unsafe-selectors/constants.tsx +69 -77
- package/src/rules/no-unsafe-selectors/source-position-utils.tsx +38 -38
- package/src/rules/no-unsafe-selectors/walk-css-map.tsx +178 -184
- package/src/rules/no-unsafe-values/README.md +34 -40
- package/src/rules/no-unsafe-values/__tests__/no-array-values.test.tsx +13 -13
- package/src/rules/no-unsafe-values/__tests__/no-conditional-values.test.tsx +18 -18
- package/src/rules/no-unsafe-values/__tests__/no-dynamic-keys.test.tsx +104 -104
- package/src/rules/no-unsafe-values/__tests__/no-function-calls.test.tsx +128 -128
- package/src/rules/no-unsafe-values/__tests__/no-identifier-arguments.test.tsx +23 -23
- package/src/rules/no-unsafe-values/__tests__/no-object-access.test.tsx +38 -38
- package/src/rules/no-unsafe-values/__tests__/no-object-references.test.tsx +18 -18
- package/src/rules/no-unsafe-values/__tests__/no-spread-elements.test.tsx +18 -18
- package/src/rules/no-unsafe-values/__tests__/no-unsafe-values.test.tsx +28 -28
- package/src/rules/no-unsafe-values/__tests__/no-variables.test.tsx +47 -47
- package/src/rules/no-unsafe-values/index.tsx +76 -78
- package/src/rules/no-unsafe-values/messages.tsx +12 -12
- package/src/rules/no-unsafe-values/utils.tsx +370 -382
- package/src/rules/use-compiled/README.md +11 -8
- package/src/rules/use-compiled/__tests__/can-auto-fix.test.tsx +32 -32
- package/src/rules/use-compiled/__tests__/css.test.tsx +53 -53
- package/src/rules/use-compiled/__tests__/imports.test.tsx +90 -95
- package/src/rules/use-compiled/__tests__/keyframes.test.tsx +47 -47
- package/src/rules/use-compiled/__tests__/pragma.test.tsx +64 -64
- package/src/rules/use-compiled/__tests__/styled.test.tsx +53 -53
- package/src/rules/use-compiled/__tests__/use-compiled.test.tsx +10 -10
- package/src/rules/use-compiled/index.tsx +203 -226
- package/src/rules/use-compiled/is-safe.tsx +113 -117
- package/src/rules/use-compiled/utils.tsx +14 -18
- package/src/rules/utils/create-rule-with-typed-config.tsx +62 -63
- 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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
errors: [{ messageId: 'unsupported-prop-syntax' }],
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
69
|
);
|