@atlaskit/eslint-plugin-ui-styling-standard 0.15.1 → 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.
- package/CHANGELOG.md +17 -0
- package/constellation/index/migration-guide.mdx +309 -0
- package/constellation/index/overview.mdx +4 -0
- package/constellation/index/props.mdx +9 -5
- package/dist/cjs/rules/no-nested-selectors/index.js +68 -49
- package/dist/es2019/rules/no-nested-selectors/index.js +63 -45
- package/dist/esm/rules/no-nested-selectors/index.js +64 -49
- 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 +186 -149
- package/src/rules/no-nested-selectors/index.tsx +92 -105
- 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 +114 -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,15 +2,15 @@ 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
|
-
|
|
5
|
+
'no-unsafe-values',
|
|
6
|
+
// @ts-expect-error
|
|
7
|
+
rule,
|
|
8
|
+
{
|
|
9
|
+
valid: [],
|
|
10
|
+
invalid: [
|
|
11
|
+
{
|
|
12
|
+
name: 'passing an object through a variable',
|
|
13
|
+
code: `
|
|
14
14
|
import { css } from '@compiled/react';
|
|
15
15
|
|
|
16
16
|
const myStyles = {
|
|
@@ -19,11 +19,11 @@ typescriptEslintTester.run(
|
|
|
19
19
|
|
|
20
20
|
const styles = css(myStyles);
|
|
21
21
|
`,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
errors: [{ messageId: 'no-identifier-arguments' }],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'passing the result of `css` through a variable',
|
|
26
|
+
code: `
|
|
27
27
|
import { css } from '@compiled/react';
|
|
28
28
|
|
|
29
29
|
const myStyles = css({
|
|
@@ -32,11 +32,11 @@ typescriptEslintTester.run(
|
|
|
32
32
|
|
|
33
33
|
const styles = css(myStyles);
|
|
34
34
|
`,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
errors: [{ messageId: 'no-identifier-arguments' }],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'passing the result of `css` through a variable to `styled`',
|
|
39
|
+
code: `
|
|
40
40
|
import { styled } from '@compiled/react';
|
|
41
41
|
|
|
42
42
|
const myStyles = css({
|
|
@@ -45,8 +45,8 @@ typescriptEslintTester.run(
|
|
|
45
45
|
|
|
46
46
|
const Component = styled.div(myStyles)
|
|
47
47
|
`,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
errors: [{ messageId: 'no-identifier-arguments' }],
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
52
|
);
|
|
@@ -2,15 +2,15 @@ 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
|
-
|
|
5
|
+
'no-unsafe-values',
|
|
6
|
+
// @ts-expect-error
|
|
7
|
+
rule,
|
|
8
|
+
{
|
|
9
|
+
valid: [],
|
|
10
|
+
invalid: [
|
|
11
|
+
{
|
|
12
|
+
name: 'object indexing as value',
|
|
13
|
+
code: `
|
|
14
14
|
import { css } from '@compiled/react';
|
|
15
15
|
|
|
16
16
|
const myVariable = {
|
|
@@ -21,11 +21,11 @@ typescriptEslintTester.run(
|
|
|
21
21
|
height: myVariable.customHeight,
|
|
22
22
|
});
|
|
23
23
|
`,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
errors: [{ messageId: 'no-object-access' }],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'object indexing as value (variant)',
|
|
28
|
+
code: `
|
|
29
29
|
import { css } from '@compiled/react';
|
|
30
30
|
|
|
31
31
|
const myVariable = {
|
|
@@ -36,11 +36,11 @@ typescriptEslintTester.run(
|
|
|
36
36
|
height: myVariable['customHeight'],
|
|
37
37
|
});
|
|
38
38
|
`,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
errors: [{ messageId: 'no-object-access' }],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'object indexing as value (indexing through a variable)',
|
|
43
|
+
code: `
|
|
44
44
|
import { css } from '@compiled/react';
|
|
45
45
|
|
|
46
46
|
const myVariable = {
|
|
@@ -53,11 +53,11 @@ typescriptEslintTester.run(
|
|
|
53
53
|
height: myVariable[otherVariable],
|
|
54
54
|
});
|
|
55
55
|
`,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
errors: [{ messageId: 'no-object-access' }],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'object indexing as value (indexing through a variable defined as a function)',
|
|
60
|
+
code: `
|
|
61
61
|
import { css } from '@compiled/react';
|
|
62
62
|
|
|
63
63
|
const myVariable = {
|
|
@@ -70,11 +70,11 @@ typescriptEslintTester.run(
|
|
|
70
70
|
height: myVariable[otherVariable],
|
|
71
71
|
});
|
|
72
72
|
`,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
errors: [{ messageId: 'no-object-access' }],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'object indexing as value (indexing through a function directly)',
|
|
77
|
+
code: `
|
|
78
78
|
import { css } from '@compiled/react';
|
|
79
79
|
|
|
80
80
|
const myVariable = {
|
|
@@ -89,18 +89,18 @@ typescriptEslintTester.run(
|
|
|
89
89
|
height: myVariable[myFunction()],
|
|
90
90
|
});
|
|
91
91
|
`,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
errors: [{ messageId: 'no-object-access' }],
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'accessing prop value',
|
|
96
|
+
code: `
|
|
97
97
|
import { styled } from '@compiled/react';
|
|
98
98
|
const styles = styled.div(
|
|
99
99
|
(props) => ({ color: props.height }),
|
|
100
100
|
);
|
|
101
101
|
`,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
errors: [{ messageId: 'no-object-access' }],
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
106
|
);
|
|
@@ -2,15 +2,15 @@ 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
|
-
|
|
5
|
+
'no-unsafe-values',
|
|
6
|
+
// @ts-expect-error
|
|
7
|
+
rule,
|
|
8
|
+
{
|
|
9
|
+
valid: [],
|
|
10
|
+
invalid: [
|
|
11
|
+
{
|
|
12
|
+
name: 'object mapping',
|
|
13
|
+
code: `
|
|
14
14
|
import { css } from '@compiled/react';
|
|
15
15
|
|
|
16
16
|
const buttonStyles = {
|
|
@@ -20,11 +20,11 @@ typescriptEslintTester.run(
|
|
|
20
20
|
button: buttonStyles,
|
|
21
21
|
})
|
|
22
22
|
`,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
errors: [{ messageId: 'no-object-references' }],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'dynamic value in object mapping',
|
|
27
|
+
code: `
|
|
28
28
|
import { css } from '@compiled/react';
|
|
29
29
|
|
|
30
30
|
function myFunction() {
|
|
@@ -37,8 +37,8 @@ typescriptEslintTester.run(
|
|
|
37
37
|
button: buttonStyles,
|
|
38
38
|
})
|
|
39
39
|
`,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
errors: [{ messageId: 'no-object-references' }],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
44
|
);
|
|
@@ -2,15 +2,15 @@ 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
|
-
|
|
5
|
+
'no-unsafe-values',
|
|
6
|
+
// @ts-expect-error
|
|
7
|
+
rule,
|
|
8
|
+
{
|
|
9
|
+
valid: [],
|
|
10
|
+
invalid: [
|
|
11
|
+
{
|
|
12
|
+
name: 'object spread',
|
|
13
|
+
code: `
|
|
14
14
|
import { css } from '@compiled/react';
|
|
15
15
|
|
|
16
16
|
const buttonStyles = {
|
|
@@ -20,11 +20,11 @@ typescriptEslintTester.run(
|
|
|
20
20
|
...buttonStyles,
|
|
21
21
|
});
|
|
22
22
|
`,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
errors: [{ messageId: 'no-spread-elements' }],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'nested object spread',
|
|
27
|
+
code: `
|
|
28
28
|
import { css } from '@compiled/react';
|
|
29
29
|
|
|
30
30
|
const buttonStyles = {
|
|
@@ -41,8 +41,8 @@ typescriptEslintTester.run(
|
|
|
41
41
|
},
|
|
42
42
|
});
|
|
43
43
|
`,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
errors: [{ messageId: 'no-spread-elements' }],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
48
|
);
|
|
@@ -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
|
+
'no-unsafe-values',
|
|
6
|
+
// @ts-expect-error
|
|
7
|
+
rule,
|
|
8
|
+
{
|
|
9
|
+
valid: [
|
|
10
|
+
{
|
|
11
|
+
name: 'literal values',
|
|
12
|
+
code: `
|
|
13
13
|
import { css } from '@compiled/react';
|
|
14
14
|
|
|
15
15
|
const styles = css({
|
|
@@ -17,10 +17,10 @@ typescriptEslintTester.run(
|
|
|
17
17
|
opacity: 1
|
|
18
18
|
});
|
|
19
19
|
`,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'variables referencing literal values',
|
|
23
|
+
code: `
|
|
24
24
|
import { css } from '@compiled/react';
|
|
25
25
|
|
|
26
26
|
const height = '5px';
|
|
@@ -30,10 +30,10 @@ typescriptEslintTester.run(
|
|
|
30
30
|
opacity
|
|
31
31
|
});
|
|
32
32
|
`,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'template strings interpolating safe values',
|
|
36
|
+
code: `
|
|
37
37
|
import { css } from '@compiled/react';
|
|
38
38
|
|
|
39
39
|
const height = 5;
|
|
@@ -45,19 +45,19 @@ typescriptEslintTester.run(
|
|
|
45
45
|
padding: \`\${paddingBlock}px \${paddingInline}px\`
|
|
46
46
|
});
|
|
47
47
|
`,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'base component',
|
|
51
|
+
code: `
|
|
52
52
|
import { styled } from '@compiled/react';
|
|
53
53
|
import { BaseComponent } from './base-component';
|
|
54
54
|
|
|
55
55
|
styled(BaseComponent)({});
|
|
56
56
|
`,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'binary operations are allowed',
|
|
60
|
+
code: `
|
|
61
61
|
import { css } from '@compiled/react';
|
|
62
62
|
|
|
63
63
|
const ITEM_HEIGHT = 40;
|
|
@@ -68,8 +68,8 @@ typescriptEslintTester.run(
|
|
|
68
68
|
marginBottom: ITEM_HEIGHT + 123,
|
|
69
69
|
});
|
|
70
70
|
`,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
invalid: [],
|
|
74
|
+
},
|
|
75
75
|
);
|
|
@@ -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
|
+
'no-unsafe-values',
|
|
6
|
+
// @ts-expect-error
|
|
7
|
+
rule,
|
|
8
|
+
{
|
|
9
|
+
valid: [
|
|
10
|
+
{
|
|
11
|
+
name: 'identifier resolves to string literal',
|
|
12
|
+
code: `
|
|
13
13
|
import { css } from '@compiled/react';
|
|
14
14
|
|
|
15
15
|
const margin = '5px';
|
|
@@ -17,10 +17,10 @@ typescriptEslintTester.run(
|
|
|
17
17
|
margin
|
|
18
18
|
})
|
|
19
19
|
`,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'identifier resolves to a template string with allowed values as interpolations',
|
|
23
|
+
code: `
|
|
24
24
|
import styled from '@emotion/styled';
|
|
25
25
|
|
|
26
26
|
import { N30A } from '@atlaskit/theme/colors';
|
|
@@ -32,23 +32,23 @@ typescriptEslintTester.run(
|
|
|
32
32
|
borderBottom: borderStyle,
|
|
33
33
|
});
|
|
34
34
|
`,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
invalid: [
|
|
38
|
+
{
|
|
39
|
+
name: 'undefined is blocked',
|
|
40
|
+
code: `
|
|
41
41
|
import { css } from '@compiled/react';
|
|
42
42
|
|
|
43
43
|
const styles = css({
|
|
44
44
|
margin: undefined
|
|
45
45
|
})
|
|
46
46
|
`,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
errors: [{ messageId: 'no-variables' }],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'undefined is still blocked even if it has been shadowed',
|
|
51
|
+
code: `
|
|
52
52
|
import { css } from '@compiled/react';
|
|
53
53
|
import { someBlockedValue as undefined } from 'my-package';
|
|
54
54
|
|
|
@@ -56,11 +56,11 @@ typescriptEslintTester.run(
|
|
|
56
56
|
margin: undefined
|
|
57
57
|
})
|
|
58
58
|
`,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
errors: [{ messageId: 'no-variables' }],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'anon function in variable as value',
|
|
63
|
+
code: `
|
|
64
64
|
import { css } from '@compiled/react';
|
|
65
65
|
|
|
66
66
|
const myFunction = function() {
|
|
@@ -71,11 +71,11 @@ typescriptEslintTester.run(
|
|
|
71
71
|
height: myFunction,
|
|
72
72
|
});
|
|
73
73
|
`,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
errors: [{ messageId: 'no-variables' }],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'arrow function in variable as value',
|
|
78
|
+
code: `
|
|
79
79
|
import { css } from '@compiled/react';
|
|
80
80
|
|
|
81
81
|
const myFunction = () => '5px';
|
|
@@ -84,11 +84,11 @@ typescriptEslintTester.run(
|
|
|
84
84
|
height: myFunction,
|
|
85
85
|
});
|
|
86
86
|
`,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
errors: [{ messageId: 'no-variables' }],
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'function in variable as value',
|
|
91
|
+
code: `
|
|
92
92
|
import { css } from '@compiled/react';
|
|
93
93
|
|
|
94
94
|
function myFunction() {
|
|
@@ -99,11 +99,11 @@ typescriptEslintTester.run(
|
|
|
99
99
|
height: myFunction,
|
|
100
100
|
});
|
|
101
101
|
`,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
errors: [{ messageId: 'no-variables' }],
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: 'variable in array argument',
|
|
106
|
+
code: `
|
|
107
107
|
import { css } from '@compiled/react';
|
|
108
108
|
|
|
109
109
|
function myFunction() {
|
|
@@ -114,8 +114,8 @@ typescriptEslintTester.run(
|
|
|
114
114
|
{ height: myFunction },
|
|
115
115
|
]);
|
|
116
116
|
`,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
errors: [{ messageId: 'no-variables' }],
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
121
|
);
|