@atlaskit/eslint-plugin-ui-styling-standard 0.18.0 → 0.18.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 +8 -0
- package/package.json +1 -1
- package/afm-cc/tsconfig.json +0 -28
- package/afm-jira/tsconfig.json +0 -27
- package/build/tsconfig.json +0 -18
- package/constellation/atlaskit-theme/usage.mdx +0 -132
- package/constellation/consistent-css-prop-usage/usage.mdx +0 -7
- package/constellation/convert-props-syntax/usage.mdx +0 -130
- package/constellation/enforce-style-prop/usage.mdx +0 -47
- package/constellation/index/migration-guide.mdx +0 -309
- package/constellation/index/overview.mdx +0 -250
- package/constellation/index/props.mdx +0 -30
- package/constellation/local-cx-xcss/usage.mdx +0 -53
- package/constellation/no-array-arguments/usage.mdx +0 -49
- package/constellation/no-classname-prop/usage.mdx +0 -49
- package/constellation/no-container-queries/usage.mdx +0 -101
- package/constellation/no-css-tagged-template-expression/usage.mdx +0 -8
- package/constellation/no-dynamic-styles/usage.mdx +0 -130
- package/constellation/no-empty-styled-expression/usage.mdx +0 -8
- package/constellation/no-exported-css/usage.mdx +0 -8
- package/constellation/no-exported-keyframes/usage.mdx +0 -8
- package/constellation/no-exported-styles/usage.mdx +0 -87
- package/constellation/no-global-styles/usage.mdx +0 -60
- package/constellation/no-important-styles/usage.mdx +0 -33
- package/constellation/no-imported-style-values/usage.mdx +0 -157
- package/constellation/no-invalid-css-map/usage.mdx +0 -8
- package/constellation/no-js-xcss/usage.mdx +0 -7
- package/constellation/no-keyframes-tagged-template-expression/usage.mdx +0 -8
- package/constellation/no-nested-selectors/usage.mdx +0 -95
- package/constellation/no-styled/usage.mdx +0 -92
- package/constellation/no-styled-tagged-template-expression/usage.mdx +0 -8
- package/constellation/no-suppress-xcss/usage.mdx +0 -28
- package/constellation/no-unsafe-selectors/usage.mdx +0 -370
- package/constellation/no-unsafe-values/usage.mdx +0 -318
- package/constellation/use-compiled/usage.mdx +0 -54
- package/index.js +0 -24
- package/scripts/codegen.tsx +0 -373
- package/src/index.codegen.tsx +0 -14
- package/src/index.tsx +0 -1
- package/src/presets/all.codegen.tsx +0 -79
- package/src/presets/recommended.codegen.tsx +0 -79
- package/src/rules/TEMPLATE.md +0 -29
- package/src/rules/__tests__/utils/_tester.tsx +0 -40
- package/src/rules/atlaskit-theme/README.md +0 -130
- package/src/rules/atlaskit-theme/__tests__/test.ts +0 -133
- package/src/rules/atlaskit-theme/index.ts +0 -134
- package/src/rules/convert-props-syntax/README.md +0 -128
- package/src/rules/convert-props-syntax/__tests__/invalid.test.tsx +0 -76
- package/src/rules/convert-props-syntax/__tests__/rule.test.tsx +0 -584
- package/src/rules/convert-props-syntax/__tests__/type-annotations.test.tsx +0 -140
- package/src/rules/convert-props-syntax/__tests__/unusual-properties.test.tsx +0 -69
- package/src/rules/convert-props-syntax/index.tsx +0 -414
- package/src/rules/enforce-style-prop/README.md +0 -45
- package/src/rules/enforce-style-prop/__tests__/rule.test.tsx +0 -243
- package/src/rules/enforce-style-prop/index.tsx +0 -172
- package/src/rules/external-rules.tsx +0 -177
- package/src/rules/index.codegen.tsx +0 -42
- package/src/rules/local-cx-xcss/README.md +0 -51
- package/src/rules/local-cx-xcss/__tests__/rule.test.tsx +0 -102
- package/src/rules/local-cx-xcss/index.tsx +0 -62
- package/src/rules/no-array-arguments/README.md +0 -47
- package/src/rules/no-array-arguments/__tests__/rule.test.tsx +0 -107
- package/src/rules/no-array-arguments/index.tsx +0 -86
- package/src/rules/no-classname-prop/README.md +0 -47
- package/src/rules/no-classname-prop/__tests__/rule.test.tsx +0 -39
- package/src/rules/no-classname-prop/index.tsx +0 -34
- package/src/rules/no-container-queries/README.md +0 -99
- package/src/rules/no-container-queries/__tests__/rule.test.tsx +0 -139
- package/src/rules/no-container-queries/index.tsx +0 -94
- package/src/rules/no-dynamic-styles/README.md +0 -128
- package/src/rules/no-dynamic-styles/__tests__/rule.test.tsx +0 -135
- package/src/rules/no-dynamic-styles/index.tsx +0 -60
- package/src/rules/no-exported-styles/README.md +0 -85
- package/src/rules/no-exported-styles/__tests__/rule.test.tsx +0 -216
- package/src/rules/no-exported-styles/index.tsx +0 -52
- package/src/rules/no-global-styles/README.md +0 -58
- package/src/rules/no-global-styles/__tests__/no-css-modules.test.tsx +0 -33
- package/src/rules/no-global-styles/__tests__/no-global-styles.test.tsx +0 -46
- package/src/rules/no-global-styles/index.tsx +0 -82
- package/src/rules/no-important-styles/README.md +0 -31
- package/src/rules/no-important-styles/__tests__/rule.test.tsx +0 -165
- package/src/rules/no-important-styles/index.tsx +0 -70
- package/src/rules/no-imported-style-values/README.md +0 -155
- package/src/rules/no-imported-style-values/__tests__/rule.test.tsx +0 -491
- package/src/rules/no-imported-style-values/index.tsx +0 -188
- package/src/rules/no-nested-selectors/README.md +0 -93
- package/src/rules/no-nested-selectors/__tests__/rule.test.tsx +0 -335
- package/src/rules/no-nested-selectors/index.tsx +0 -99
- package/src/rules/no-styled/README.md +0 -90
- package/src/rules/no-styled/__tests__/rule.test.tsx +0 -73
- package/src/rules/no-styled/index.tsx +0 -45
- package/src/rules/no-unsafe-selectors/README.md +0 -368
- package/src/rules/no-unsafe-selectors/__tests__/no-ambiguous-pseudos.test.tsx +0 -368
- package/src/rules/no-unsafe-selectors/__tests__/no-grouped-at-rules.test.tsx +0 -57
- package/src/rules/no-unsafe-selectors/__tests__/no-increased-specificity.test.tsx +0 -73
- package/src/rules/no-unsafe-selectors/__tests__/no-keyframes-at-rules.test.tsx +0 -40
- package/src/rules/no-unsafe-selectors/__tests__/no-legacy-pseudo-element-syntax.test.tsx +0 -101
- package/src/rules/no-unsafe-selectors/__tests__/no-restricted-at-rules.test.tsx +0 -131
- package/src/rules/no-unsafe-selectors/__tests__/no-restricted-pseudos.test.tsx +0 -132
- package/src/rules/no-unsafe-selectors/__tests__/no-selectors-object.test.tsx +0 -25
- package/src/rules/no-unsafe-selectors/__tests__/no-unparsable-selectors.test.tsx +0 -35
- package/src/rules/no-unsafe-selectors/__tests__/rule.test.tsx +0 -257
- package/src/rules/no-unsafe-selectors/constants.tsx +0 -91
- package/src/rules/no-unsafe-selectors/index.tsx +0 -198
- package/src/rules/no-unsafe-selectors/lint-selector.tsx +0 -155
- package/src/rules/no-unsafe-selectors/source-position-utils.tsx +0 -55
- package/src/rules/no-unsafe-selectors/walk-css-map.tsx +0 -226
- package/src/rules/no-unsafe-values/README.md +0 -316
- package/src/rules/no-unsafe-values/__tests__/no-array-values.test.tsx +0 -27
- package/src/rules/no-unsafe-values/__tests__/no-conditional-values.test.tsx +0 -37
- package/src/rules/no-unsafe-values/__tests__/no-dynamic-keys.test.tsx +0 -229
- package/src/rules/no-unsafe-values/__tests__/no-function-calls.test.tsx +0 -267
- package/src/rules/no-unsafe-values/__tests__/no-identifier-arguments.test.tsx +0 -52
- package/src/rules/no-unsafe-values/__tests__/no-object-access.test.tsx +0 -106
- package/src/rules/no-unsafe-values/__tests__/no-object-references.test.tsx +0 -44
- package/src/rules/no-unsafe-values/__tests__/no-spread-elements.test.tsx +0 -48
- package/src/rules/no-unsafe-values/__tests__/no-unsafe-values.test.tsx +0 -75
- package/src/rules/no-unsafe-values/__tests__/no-variables.test.tsx +0 -121
- package/src/rules/no-unsafe-values/index.tsx +0 -94
- package/src/rules/no-unsafe-values/messages.tsx +0 -86
- package/src/rules/no-unsafe-values/utils.tsx +0 -387
- package/src/rules/use-compiled/README.md +0 -52
- package/src/rules/use-compiled/__tests__/can-auto-fix.test.tsx +0 -73
- package/src/rules/use-compiled/__tests__/css.test.tsx +0 -126
- package/src/rules/use-compiled/__tests__/imports.test.tsx +0 -158
- package/src/rules/use-compiled/__tests__/keyframes.test.tsx +0 -140
- package/src/rules/use-compiled/__tests__/pragma.test.tsx +0 -108
- package/src/rules/use-compiled/__tests__/styled.test.tsx +0 -114
- package/src/rules/use-compiled/__tests__/use-compiled.test.tsx +0 -15
- package/src/rules/use-compiled/index.tsx +0 -252
- package/src/rules/use-compiled/is-safe.tsx +0 -159
- package/src/rules/use-compiled/utils.tsx +0 -33
- package/src/rules/utils/create-rule-with-typed-config.tsx +0 -86
- package/src/rules/utils/create-rule.tsx +0 -13
- package/tsconfig.app.json +0 -47
- package/tsconfig.dev.json +0 -45
- package/tsconfig.json +0 -25
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { tester } from '../../__tests__/utils/_tester';
|
|
2
|
-
import rule from '../index';
|
|
3
|
-
|
|
4
|
-
tester.run('no-restricted-at-rules', rule, {
|
|
5
|
-
valid: [
|
|
6
|
-
{
|
|
7
|
-
name: '@media',
|
|
8
|
-
code: `
|
|
9
|
-
import { css } from '@compiled/react';
|
|
10
|
-
|
|
11
|
-
css({
|
|
12
|
-
'@media screen and (min-width: 900px)': {}
|
|
13
|
-
});
|
|
14
|
-
`,
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
name: '@media in cssMap',
|
|
18
|
-
code: `
|
|
19
|
-
import { cssMap } from '@compiled/react';
|
|
20
|
-
|
|
21
|
-
const myMap = cssMap({
|
|
22
|
-
danger: {
|
|
23
|
-
color: 'red',
|
|
24
|
-
'@media (min-width: 500px)': {
|
|
25
|
-
fontSize: '1.5em',
|
|
26
|
-
},
|
|
27
|
-
'@media (max-width: 800px)': {
|
|
28
|
-
fontSize: '1.8em',
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
`,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name: 'no space after rule name',
|
|
36
|
-
code: `
|
|
37
|
-
import { css } from '@compiled/react';
|
|
38
|
-
|
|
39
|
-
css({
|
|
40
|
-
'@supports(display: flex)': {}
|
|
41
|
-
});
|
|
42
|
-
`,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: '@supports',
|
|
46
|
-
code: `
|
|
47
|
-
import { css } from '@compiled/react';
|
|
48
|
-
|
|
49
|
-
css({
|
|
50
|
-
'@supports (display: flex)': {}
|
|
51
|
-
});
|
|
52
|
-
`,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: '@container',
|
|
56
|
-
code: `
|
|
57
|
-
import { css } from '@compiled/react';
|
|
58
|
-
|
|
59
|
-
css({
|
|
60
|
-
'@container (width > 400px)': {}
|
|
61
|
-
});
|
|
62
|
-
`,
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
name: '@property',
|
|
66
|
-
code: `
|
|
67
|
-
import { css } from '@compiled/react';
|
|
68
|
-
|
|
69
|
-
css({
|
|
70
|
-
'@property --property-name': {
|
|
71
|
-
syntax: '"<color>"',
|
|
72
|
-
inherits: 'false',
|
|
73
|
-
initialValue: '#c0ffee',
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
`,
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
invalid: [
|
|
80
|
-
{
|
|
81
|
-
name: '@color-profile',
|
|
82
|
-
code: `
|
|
83
|
-
import { css } from '@compiled/react';
|
|
84
|
-
|
|
85
|
-
css({
|
|
86
|
-
'@color-profile --swop5c': {}
|
|
87
|
-
});
|
|
88
|
-
`,
|
|
89
|
-
errors: [
|
|
90
|
-
{
|
|
91
|
-
messageId: 'no-restricted-at-rules',
|
|
92
|
-
data: { atRule: '@color-profile' },
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
name: '@scope',
|
|
98
|
-
code: `
|
|
99
|
-
import { css } from '@compiled/react';
|
|
100
|
-
|
|
101
|
-
css({
|
|
102
|
-
'@scope (.article-body) to (figure)': {}
|
|
103
|
-
});
|
|
104
|
-
`,
|
|
105
|
-
errors: [
|
|
106
|
-
{
|
|
107
|
-
messageId: 'no-restricted-at-rules',
|
|
108
|
-
data: { atRule: '@scope' },
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
name: '@scope in cssMap',
|
|
114
|
-
code: `
|
|
115
|
-
import { cssMap } from '@compiled/react';
|
|
116
|
-
|
|
117
|
-
cssMap({
|
|
118
|
-
base: {
|
|
119
|
-
'@scope (.article-body) to (figure)': {}
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
`,
|
|
123
|
-
errors: [
|
|
124
|
-
{
|
|
125
|
-
messageId: 'no-restricted-at-rules',
|
|
126
|
-
data: { atRule: '@scope' },
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
});
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { tester } from '../../__tests__/utils/_tester';
|
|
2
|
-
import rule from '../index';
|
|
3
|
-
|
|
4
|
-
tester.run('no-restricted-pseudos', rule, {
|
|
5
|
-
valid: [
|
|
6
|
-
{
|
|
7
|
-
name: ':hover',
|
|
8
|
-
code: `
|
|
9
|
-
import { css } from '@compiled/react';
|
|
10
|
-
|
|
11
|
-
css({
|
|
12
|
-
'&:hover': {}
|
|
13
|
-
});
|
|
14
|
-
`,
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
name: ':active',
|
|
18
|
-
code: `
|
|
19
|
-
import { css } from '@compiled/react';
|
|
20
|
-
|
|
21
|
-
css({
|
|
22
|
-
'&:active': {}
|
|
23
|
-
});
|
|
24
|
-
`,
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
invalid: [
|
|
28
|
-
{
|
|
29
|
-
name: ':has()',
|
|
30
|
-
code: `
|
|
31
|
-
import { css } from '@compiled/react';
|
|
32
|
-
|
|
33
|
-
css({
|
|
34
|
-
'&:has(div)': {},
|
|
35
|
-
});
|
|
36
|
-
`,
|
|
37
|
-
errors: [
|
|
38
|
-
{
|
|
39
|
-
messageId: 'no-restricted-pseudos',
|
|
40
|
-
line: 5,
|
|
41
|
-
column: 13,
|
|
42
|
-
endColumn: 17,
|
|
43
|
-
data: { pseudo: ':has' },
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: ':first-child',
|
|
49
|
-
code: `
|
|
50
|
-
import { css } from '@compiled/react';
|
|
51
|
-
|
|
52
|
-
css({
|
|
53
|
-
'&:first-child': {},
|
|
54
|
-
});
|
|
55
|
-
`,
|
|
56
|
-
errors: [
|
|
57
|
-
{
|
|
58
|
-
messageId: 'no-restricted-pseudos',
|
|
59
|
-
line: 5,
|
|
60
|
-
column: 13,
|
|
61
|
-
endColumn: 25,
|
|
62
|
-
data: {
|
|
63
|
-
pseudo: ':first-child',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: ':first-of-type',
|
|
70
|
-
code: `
|
|
71
|
-
import { css } from '@compiled/react';
|
|
72
|
-
|
|
73
|
-
css({
|
|
74
|
-
'&:first-of-type': {},
|
|
75
|
-
});
|
|
76
|
-
`,
|
|
77
|
-
errors: [
|
|
78
|
-
{
|
|
79
|
-
messageId: 'no-restricted-pseudos',
|
|
80
|
-
line: 5,
|
|
81
|
-
column: 13,
|
|
82
|
-
endColumn: 27,
|
|
83
|
-
data: {
|
|
84
|
-
pseudo: ':first-of-type',
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: ':nth-child(2)',
|
|
91
|
-
code: `
|
|
92
|
-
import { css } from '@compiled/react';
|
|
93
|
-
|
|
94
|
-
css({
|
|
95
|
-
'&:nth-child(2)': {},
|
|
96
|
-
});
|
|
97
|
-
`,
|
|
98
|
-
errors: [
|
|
99
|
-
{
|
|
100
|
-
messageId: 'no-restricted-pseudos',
|
|
101
|
-
line: 5,
|
|
102
|
-
column: 13,
|
|
103
|
-
endColumn: 23,
|
|
104
|
-
data: {
|
|
105
|
-
pseudo: ':nth-child',
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
name: 'compound selector with child selectors',
|
|
112
|
-
code: `
|
|
113
|
-
import { css } from '@compiled/react';
|
|
114
|
-
|
|
115
|
-
css({
|
|
116
|
-
'&:hover:first-child:active': {},
|
|
117
|
-
});
|
|
118
|
-
`,
|
|
119
|
-
errors: [
|
|
120
|
-
{
|
|
121
|
-
messageId: 'no-restricted-pseudos',
|
|
122
|
-
line: 5,
|
|
123
|
-
column: 19,
|
|
124
|
-
endColumn: 31,
|
|
125
|
-
data: {
|
|
126
|
-
pseudo: ':first-child',
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
},
|
|
131
|
-
],
|
|
132
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { tester } from '../../__tests__/utils/_tester';
|
|
2
|
-
import rule from '../index';
|
|
3
|
-
|
|
4
|
-
tester.run('no-selectors-object', rule, {
|
|
5
|
-
valid: [],
|
|
6
|
-
invalid: [
|
|
7
|
-
{
|
|
8
|
-
name: 'selectors object is provided',
|
|
9
|
-
code: `
|
|
10
|
-
import { cssMap } from '@compiled/react';
|
|
11
|
-
|
|
12
|
-
cssMap({
|
|
13
|
-
variant: {
|
|
14
|
-
selectors: {}
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
`,
|
|
18
|
-
errors: [
|
|
19
|
-
{
|
|
20
|
-
messageId: 'no-selectors-object',
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { tester } from '../../__tests__/utils/_tester';
|
|
2
|
-
import rule from '../index';
|
|
3
|
-
|
|
4
|
-
tester.run('no-unparsable-selectors', rule, {
|
|
5
|
-
valid: [],
|
|
6
|
-
invalid: [
|
|
7
|
-
{
|
|
8
|
-
name: 'unparsable selectors',
|
|
9
|
-
code: `
|
|
10
|
-
import { css } from '@emotion/react';
|
|
11
|
-
|
|
12
|
-
css({
|
|
13
|
-
'[&]': {},
|
|
14
|
-
':name:': {},
|
|
15
|
-
});
|
|
16
|
-
`,
|
|
17
|
-
errors: [
|
|
18
|
-
{
|
|
19
|
-
messageId: 'no-unparsable-selectors',
|
|
20
|
-
data: { selectorText: '[&]' },
|
|
21
|
-
line: 5,
|
|
22
|
-
column: 11,
|
|
23
|
-
endColumn: 16,
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
messageId: 'no-unparsable-selectors',
|
|
27
|
-
data: { selectorText: ':name:' },
|
|
28
|
-
line: 6,
|
|
29
|
-
column: 11,
|
|
30
|
-
endColumn: 19,
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
});
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
import outdent from 'outdent';
|
|
2
|
-
import { tester } from '../../__tests__/utils/_tester';
|
|
3
|
-
import rule from '../index';
|
|
4
|
-
|
|
5
|
-
tester.run('no-unsafe-selectors', rule, {
|
|
6
|
-
valid: [
|
|
7
|
-
{
|
|
8
|
-
name: 'css API valid usage',
|
|
9
|
-
code: `
|
|
10
|
-
import { css } from '@compiled/react';
|
|
11
|
-
|
|
12
|
-
css({
|
|
13
|
-
'&:hover': {},
|
|
14
|
-
'&:focus, &:active': {},
|
|
15
|
-
});
|
|
16
|
-
`,
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
name: 'styled API valid usage',
|
|
20
|
-
code: `
|
|
21
|
-
import { styled } from '@compiled/react';
|
|
22
|
-
|
|
23
|
-
styled.div({
|
|
24
|
-
'&:hover': {},
|
|
25
|
-
'&:focus, &:active': {},
|
|
26
|
-
});
|
|
27
|
-
`,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'keyframes API valid usage',
|
|
31
|
-
code: `
|
|
32
|
-
import { keyframes } from '@compiled/react';
|
|
33
|
-
|
|
34
|
-
keyframes({
|
|
35
|
-
'0%': {
|
|
36
|
-
'&:hover': {},
|
|
37
|
-
'&:focus, &:active': {},
|
|
38
|
-
},
|
|
39
|
-
'100%': {
|
|
40
|
-
'&:hover': {},
|
|
41
|
-
'&:focus, &:active': {},
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
`,
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: 'xcss API valid usage',
|
|
48
|
-
code: `
|
|
49
|
-
import { xcss } from '@atlaskit/primitives';
|
|
50
|
-
|
|
51
|
-
xcss({
|
|
52
|
-
'&:hover': {},
|
|
53
|
-
});
|
|
54
|
-
`,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: 'cssMap API valid usage',
|
|
58
|
-
code: `
|
|
59
|
-
import { cssMap } from '@atlaskit/primitives';
|
|
60
|
-
|
|
61
|
-
cssMap({
|
|
62
|
-
':name:': {
|
|
63
|
-
'&:hover': {},
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
`,
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
invalid: [
|
|
70
|
-
{
|
|
71
|
-
name: 'css API invalid usage',
|
|
72
|
-
code: outdent`
|
|
73
|
-
import { css } from '@compiled/react';
|
|
74
|
-
|
|
75
|
-
css({
|
|
76
|
-
':hover': {},
|
|
77
|
-
'&:after': {},
|
|
78
|
-
});
|
|
79
|
-
`,
|
|
80
|
-
output: outdent`
|
|
81
|
-
import { css } from '@compiled/react';
|
|
82
|
-
|
|
83
|
-
css({
|
|
84
|
-
'&:hover': {},
|
|
85
|
-
'&::after': {},
|
|
86
|
-
});
|
|
87
|
-
`,
|
|
88
|
-
errors: [
|
|
89
|
-
{
|
|
90
|
-
messageId: 'no-ambiguous-pseudos',
|
|
91
|
-
line: 4,
|
|
92
|
-
column: 4,
|
|
93
|
-
endColumn: 10,
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
messageId: 'no-legacy-pseudo-element-syntax',
|
|
97
|
-
line: 5,
|
|
98
|
-
column: 5,
|
|
99
|
-
endColumn: 11,
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
name: 'styled API invalid usage',
|
|
105
|
-
code: `
|
|
106
|
-
import { styled } from '@compiled/react';
|
|
107
|
-
|
|
108
|
-
styled.div({
|
|
109
|
-
'@keyframes fadeIn': {},
|
|
110
|
-
'@media screen and (width < 900px)': {},
|
|
111
|
-
'@supports (display: flex)': {},
|
|
112
|
-
'@scope (article) to (figure)': {},
|
|
113
|
-
});
|
|
114
|
-
`,
|
|
115
|
-
errors: [
|
|
116
|
-
{
|
|
117
|
-
messageId: 'no-keyframes-at-rules',
|
|
118
|
-
line: 5,
|
|
119
|
-
column: 11,
|
|
120
|
-
endColumn: 30,
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
messageId: 'no-restricted-at-rules',
|
|
124
|
-
line: 8,
|
|
125
|
-
column: 11,
|
|
126
|
-
endColumn: 41,
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
name: 'styled API extending base component',
|
|
132
|
-
code: `
|
|
133
|
-
import { styled } from '@compiled/react';
|
|
134
|
-
import { BaseComponent } from './base-component';
|
|
135
|
-
|
|
136
|
-
styled(BaseComponent)({
|
|
137
|
-
'@keyframes fadeIn': {},
|
|
138
|
-
});
|
|
139
|
-
`,
|
|
140
|
-
errors: [
|
|
141
|
-
{
|
|
142
|
-
messageId: 'no-keyframes-at-rules',
|
|
143
|
-
line: 6,
|
|
144
|
-
column: 11,
|
|
145
|
-
endColumn: 30,
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
name: 'keyframes API invalid usage',
|
|
151
|
-
code: outdent`
|
|
152
|
-
import { keyframes } from '@emotion/react';
|
|
153
|
-
|
|
154
|
-
keyframes({
|
|
155
|
-
'0%': {
|
|
156
|
-
':hover': {},
|
|
157
|
-
},
|
|
158
|
-
'100%': {
|
|
159
|
-
'&:abcd': {}
|
|
160
|
-
},
|
|
161
|
-
':hover': {}, // Not valid but shouldn't be picked up by this rule
|
|
162
|
-
});
|
|
163
|
-
`,
|
|
164
|
-
output: outdent`
|
|
165
|
-
import { keyframes } from '@emotion/react';
|
|
166
|
-
|
|
167
|
-
keyframes({
|
|
168
|
-
'0%': {
|
|
169
|
-
'&:hover': {},
|
|
170
|
-
},
|
|
171
|
-
'100%': {
|
|
172
|
-
'&:abcd': {}
|
|
173
|
-
},
|
|
174
|
-
':hover': {}, // Not valid but shouldn't be picked up by this rule
|
|
175
|
-
});
|
|
176
|
-
`,
|
|
177
|
-
errors: [
|
|
178
|
-
{
|
|
179
|
-
messageId: 'no-ambiguous-pseudos',
|
|
180
|
-
line: 5,
|
|
181
|
-
column: 6,
|
|
182
|
-
endColumn: 12,
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
messageId: 'no-restricted-pseudos',
|
|
186
|
-
line: 8,
|
|
187
|
-
column: 7,
|
|
188
|
-
endColumn: 12,
|
|
189
|
-
},
|
|
190
|
-
],
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
name: 'xcss API invalid usage',
|
|
194
|
-
code: `
|
|
195
|
-
import { xcss } from '@atlaskit/primitives';
|
|
196
|
-
|
|
197
|
-
xcss({
|
|
198
|
-
'&&&&&&': {},
|
|
199
|
-
});
|
|
200
|
-
`,
|
|
201
|
-
errors: [
|
|
202
|
-
{
|
|
203
|
-
messageId: 'no-increased-specificity',
|
|
204
|
-
line: 5,
|
|
205
|
-
column: 12,
|
|
206
|
-
endColumn: 18,
|
|
207
|
-
},
|
|
208
|
-
],
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
name: 'cssMap API invalid usage',
|
|
212
|
-
code: outdent`
|
|
213
|
-
import { cssMap } from '@atlaskit/primitives';
|
|
214
|
-
|
|
215
|
-
cssMap({
|
|
216
|
-
':name:': {
|
|
217
|
-
':hover': {},
|
|
218
|
-
},
|
|
219
|
-
':hover': {},
|
|
220
|
-
'[&]': {
|
|
221
|
-
'&:first-child': {}
|
|
222
|
-
},
|
|
223
|
-
});
|
|
224
|
-
`,
|
|
225
|
-
output: outdent`
|
|
226
|
-
import { cssMap } from '@atlaskit/primitives';
|
|
227
|
-
|
|
228
|
-
cssMap({
|
|
229
|
-
':name:': {
|
|
230
|
-
'&:hover': {},
|
|
231
|
-
},
|
|
232
|
-
':hover': {},
|
|
233
|
-
'[&]': {
|
|
234
|
-
'&:first-child': {}
|
|
235
|
-
},
|
|
236
|
-
});
|
|
237
|
-
`,
|
|
238
|
-
errors: [
|
|
239
|
-
{
|
|
240
|
-
messageId: 'no-ambiguous-pseudos',
|
|
241
|
-
line: 5,
|
|
242
|
-
column: 6,
|
|
243
|
-
endColumn: 12,
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
messageId: 'no-restricted-pseudos',
|
|
247
|
-
data: {
|
|
248
|
-
pseudo: ':first-child',
|
|
249
|
-
},
|
|
250
|
-
line: 9,
|
|
251
|
-
column: 7,
|
|
252
|
-
endColumn: 19,
|
|
253
|
-
},
|
|
254
|
-
],
|
|
255
|
-
},
|
|
256
|
-
],
|
|
257
|
-
});
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import type { CSSPseudos } from '@compiled/react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Validation approach from
|
|
5
|
-
* https://stackoverflow.com/a/71236280
|
|
6
|
-
*/
|
|
7
|
-
type Validate<T extends true> = T;
|
|
8
|
-
type HasAllUnique<Tuple, Union, Seen = never> = Tuple extends readonly [infer Head, ...infer Tail]
|
|
9
|
-
? Head extends Seen
|
|
10
|
-
? {
|
|
11
|
-
ERROR: ['The following key appears more than once in the tuple:', Head];
|
|
12
|
-
}
|
|
13
|
-
: HasAllUnique<Tail, Exclude<Union, Head>, Head | Seen>
|
|
14
|
-
: [Union] extends [never]
|
|
15
|
-
? true
|
|
16
|
-
: { ERROR: ['Some keys are missing from the tuple:', Union] };
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Exporting this so it isn't considered unused.
|
|
20
|
-
*/
|
|
21
|
-
export type _ = Validate<HasAllUnique<typeof cssPseudos, CSSPseudos>>;
|
|
22
|
-
|
|
23
|
-
const cssPseudos = [
|
|
24
|
-
'&:active',
|
|
25
|
-
'&:autofill',
|
|
26
|
-
'&:blank',
|
|
27
|
-
'&:checked',
|
|
28
|
-
'&:default',
|
|
29
|
-
'&:defined',
|
|
30
|
-
'&:disabled',
|
|
31
|
-
'&:empty',
|
|
32
|
-
'&:enabled',
|
|
33
|
-
'&:first',
|
|
34
|
-
'&:focus',
|
|
35
|
-
'&:focus-visible',
|
|
36
|
-
'&:focus-within',
|
|
37
|
-
'&:fullscreen',
|
|
38
|
-
'&:hover',
|
|
39
|
-
'&:in-range',
|
|
40
|
-
'&:indeterminate',
|
|
41
|
-
'&:invalid',
|
|
42
|
-
'&:left',
|
|
43
|
-
'&:link',
|
|
44
|
-
'&:local-link',
|
|
45
|
-
'&:optional',
|
|
46
|
-
'&:out-of-range',
|
|
47
|
-
'&:paused',
|
|
48
|
-
'&:picture-in-picture',
|
|
49
|
-
'&:placeholder-shown',
|
|
50
|
-
'&:playing',
|
|
51
|
-
'&:read-only',
|
|
52
|
-
'&:read-write',
|
|
53
|
-
'&:required',
|
|
54
|
-
'&:right',
|
|
55
|
-
'&:target',
|
|
56
|
-
'&:user-invalid',
|
|
57
|
-
'&:user-valid',
|
|
58
|
-
'&:valid',
|
|
59
|
-
'&:visited',
|
|
60
|
-
'&::after',
|
|
61
|
-
'&::backdrop',
|
|
62
|
-
'&::before',
|
|
63
|
-
'&::cue',
|
|
64
|
-
'&::cue-region',
|
|
65
|
-
'&::first-letter',
|
|
66
|
-
'&::first-line',
|
|
67
|
-
'&::grammar-error',
|
|
68
|
-
'&::marker',
|
|
69
|
-
'&::placeholder',
|
|
70
|
-
'&::selection',
|
|
71
|
-
'&::spelling-error',
|
|
72
|
-
'&::target-text',
|
|
73
|
-
'&::view-transition',
|
|
74
|
-
] as const;
|
|
75
|
-
|
|
76
|
-
export const allowedPseudos = new Set(
|
|
77
|
-
/**
|
|
78
|
-
* The `&` is included above for type checking reasons,
|
|
79
|
-
* but we don't actually want it when consuming the values.
|
|
80
|
-
*/
|
|
81
|
-
cssPseudos.map((pseudo) => pseudo.slice(1)),
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
export const legacyPseudoElements = new Set([':after', ':before', ':first-letter', ':first-line']);
|
|
85
|
-
|
|
86
|
-
export const ignoredAtRules = new Set([
|
|
87
|
-
'@container', // ignored because it's covered by `no-container-queries`
|
|
88
|
-
'@media', // ignored because it's covered by `no-nested-styles`
|
|
89
|
-
'@supports',
|
|
90
|
-
'@property',
|
|
91
|
-
]);
|