@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.
Files changed (137) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +1 -1
  3. package/afm-cc/tsconfig.json +0 -28
  4. package/afm-jira/tsconfig.json +0 -27
  5. package/build/tsconfig.json +0 -18
  6. package/constellation/atlaskit-theme/usage.mdx +0 -132
  7. package/constellation/consistent-css-prop-usage/usage.mdx +0 -7
  8. package/constellation/convert-props-syntax/usage.mdx +0 -130
  9. package/constellation/enforce-style-prop/usage.mdx +0 -47
  10. package/constellation/index/migration-guide.mdx +0 -309
  11. package/constellation/index/overview.mdx +0 -250
  12. package/constellation/index/props.mdx +0 -30
  13. package/constellation/local-cx-xcss/usage.mdx +0 -53
  14. package/constellation/no-array-arguments/usage.mdx +0 -49
  15. package/constellation/no-classname-prop/usage.mdx +0 -49
  16. package/constellation/no-container-queries/usage.mdx +0 -101
  17. package/constellation/no-css-tagged-template-expression/usage.mdx +0 -8
  18. package/constellation/no-dynamic-styles/usage.mdx +0 -130
  19. package/constellation/no-empty-styled-expression/usage.mdx +0 -8
  20. package/constellation/no-exported-css/usage.mdx +0 -8
  21. package/constellation/no-exported-keyframes/usage.mdx +0 -8
  22. package/constellation/no-exported-styles/usage.mdx +0 -87
  23. package/constellation/no-global-styles/usage.mdx +0 -60
  24. package/constellation/no-important-styles/usage.mdx +0 -33
  25. package/constellation/no-imported-style-values/usage.mdx +0 -157
  26. package/constellation/no-invalid-css-map/usage.mdx +0 -8
  27. package/constellation/no-js-xcss/usage.mdx +0 -7
  28. package/constellation/no-keyframes-tagged-template-expression/usage.mdx +0 -8
  29. package/constellation/no-nested-selectors/usage.mdx +0 -95
  30. package/constellation/no-styled/usage.mdx +0 -92
  31. package/constellation/no-styled-tagged-template-expression/usage.mdx +0 -8
  32. package/constellation/no-suppress-xcss/usage.mdx +0 -28
  33. package/constellation/no-unsafe-selectors/usage.mdx +0 -370
  34. package/constellation/no-unsafe-values/usage.mdx +0 -318
  35. package/constellation/use-compiled/usage.mdx +0 -54
  36. package/index.js +0 -24
  37. package/scripts/codegen.tsx +0 -373
  38. package/src/index.codegen.tsx +0 -14
  39. package/src/index.tsx +0 -1
  40. package/src/presets/all.codegen.tsx +0 -79
  41. package/src/presets/recommended.codegen.tsx +0 -79
  42. package/src/rules/TEMPLATE.md +0 -29
  43. package/src/rules/__tests__/utils/_tester.tsx +0 -40
  44. package/src/rules/atlaskit-theme/README.md +0 -130
  45. package/src/rules/atlaskit-theme/__tests__/test.ts +0 -133
  46. package/src/rules/atlaskit-theme/index.ts +0 -134
  47. package/src/rules/convert-props-syntax/README.md +0 -128
  48. package/src/rules/convert-props-syntax/__tests__/invalid.test.tsx +0 -76
  49. package/src/rules/convert-props-syntax/__tests__/rule.test.tsx +0 -584
  50. package/src/rules/convert-props-syntax/__tests__/type-annotations.test.tsx +0 -140
  51. package/src/rules/convert-props-syntax/__tests__/unusual-properties.test.tsx +0 -69
  52. package/src/rules/convert-props-syntax/index.tsx +0 -414
  53. package/src/rules/enforce-style-prop/README.md +0 -45
  54. package/src/rules/enforce-style-prop/__tests__/rule.test.tsx +0 -243
  55. package/src/rules/enforce-style-prop/index.tsx +0 -172
  56. package/src/rules/external-rules.tsx +0 -177
  57. package/src/rules/index.codegen.tsx +0 -42
  58. package/src/rules/local-cx-xcss/README.md +0 -51
  59. package/src/rules/local-cx-xcss/__tests__/rule.test.tsx +0 -102
  60. package/src/rules/local-cx-xcss/index.tsx +0 -62
  61. package/src/rules/no-array-arguments/README.md +0 -47
  62. package/src/rules/no-array-arguments/__tests__/rule.test.tsx +0 -107
  63. package/src/rules/no-array-arguments/index.tsx +0 -86
  64. package/src/rules/no-classname-prop/README.md +0 -47
  65. package/src/rules/no-classname-prop/__tests__/rule.test.tsx +0 -39
  66. package/src/rules/no-classname-prop/index.tsx +0 -34
  67. package/src/rules/no-container-queries/README.md +0 -99
  68. package/src/rules/no-container-queries/__tests__/rule.test.tsx +0 -139
  69. package/src/rules/no-container-queries/index.tsx +0 -94
  70. package/src/rules/no-dynamic-styles/README.md +0 -128
  71. package/src/rules/no-dynamic-styles/__tests__/rule.test.tsx +0 -135
  72. package/src/rules/no-dynamic-styles/index.tsx +0 -60
  73. package/src/rules/no-exported-styles/README.md +0 -85
  74. package/src/rules/no-exported-styles/__tests__/rule.test.tsx +0 -216
  75. package/src/rules/no-exported-styles/index.tsx +0 -52
  76. package/src/rules/no-global-styles/README.md +0 -58
  77. package/src/rules/no-global-styles/__tests__/no-css-modules.test.tsx +0 -33
  78. package/src/rules/no-global-styles/__tests__/no-global-styles.test.tsx +0 -46
  79. package/src/rules/no-global-styles/index.tsx +0 -82
  80. package/src/rules/no-important-styles/README.md +0 -31
  81. package/src/rules/no-important-styles/__tests__/rule.test.tsx +0 -165
  82. package/src/rules/no-important-styles/index.tsx +0 -70
  83. package/src/rules/no-imported-style-values/README.md +0 -155
  84. package/src/rules/no-imported-style-values/__tests__/rule.test.tsx +0 -491
  85. package/src/rules/no-imported-style-values/index.tsx +0 -188
  86. package/src/rules/no-nested-selectors/README.md +0 -93
  87. package/src/rules/no-nested-selectors/__tests__/rule.test.tsx +0 -335
  88. package/src/rules/no-nested-selectors/index.tsx +0 -99
  89. package/src/rules/no-styled/README.md +0 -90
  90. package/src/rules/no-styled/__tests__/rule.test.tsx +0 -73
  91. package/src/rules/no-styled/index.tsx +0 -45
  92. package/src/rules/no-unsafe-selectors/README.md +0 -368
  93. package/src/rules/no-unsafe-selectors/__tests__/no-ambiguous-pseudos.test.tsx +0 -368
  94. package/src/rules/no-unsafe-selectors/__tests__/no-grouped-at-rules.test.tsx +0 -57
  95. package/src/rules/no-unsafe-selectors/__tests__/no-increased-specificity.test.tsx +0 -73
  96. package/src/rules/no-unsafe-selectors/__tests__/no-keyframes-at-rules.test.tsx +0 -40
  97. package/src/rules/no-unsafe-selectors/__tests__/no-legacy-pseudo-element-syntax.test.tsx +0 -101
  98. package/src/rules/no-unsafe-selectors/__tests__/no-restricted-at-rules.test.tsx +0 -131
  99. package/src/rules/no-unsafe-selectors/__tests__/no-restricted-pseudos.test.tsx +0 -132
  100. package/src/rules/no-unsafe-selectors/__tests__/no-selectors-object.test.tsx +0 -25
  101. package/src/rules/no-unsafe-selectors/__tests__/no-unparsable-selectors.test.tsx +0 -35
  102. package/src/rules/no-unsafe-selectors/__tests__/rule.test.tsx +0 -257
  103. package/src/rules/no-unsafe-selectors/constants.tsx +0 -91
  104. package/src/rules/no-unsafe-selectors/index.tsx +0 -198
  105. package/src/rules/no-unsafe-selectors/lint-selector.tsx +0 -155
  106. package/src/rules/no-unsafe-selectors/source-position-utils.tsx +0 -55
  107. package/src/rules/no-unsafe-selectors/walk-css-map.tsx +0 -226
  108. package/src/rules/no-unsafe-values/README.md +0 -316
  109. package/src/rules/no-unsafe-values/__tests__/no-array-values.test.tsx +0 -27
  110. package/src/rules/no-unsafe-values/__tests__/no-conditional-values.test.tsx +0 -37
  111. package/src/rules/no-unsafe-values/__tests__/no-dynamic-keys.test.tsx +0 -229
  112. package/src/rules/no-unsafe-values/__tests__/no-function-calls.test.tsx +0 -267
  113. package/src/rules/no-unsafe-values/__tests__/no-identifier-arguments.test.tsx +0 -52
  114. package/src/rules/no-unsafe-values/__tests__/no-object-access.test.tsx +0 -106
  115. package/src/rules/no-unsafe-values/__tests__/no-object-references.test.tsx +0 -44
  116. package/src/rules/no-unsafe-values/__tests__/no-spread-elements.test.tsx +0 -48
  117. package/src/rules/no-unsafe-values/__tests__/no-unsafe-values.test.tsx +0 -75
  118. package/src/rules/no-unsafe-values/__tests__/no-variables.test.tsx +0 -121
  119. package/src/rules/no-unsafe-values/index.tsx +0 -94
  120. package/src/rules/no-unsafe-values/messages.tsx +0 -86
  121. package/src/rules/no-unsafe-values/utils.tsx +0 -387
  122. package/src/rules/use-compiled/README.md +0 -52
  123. package/src/rules/use-compiled/__tests__/can-auto-fix.test.tsx +0 -73
  124. package/src/rules/use-compiled/__tests__/css.test.tsx +0 -126
  125. package/src/rules/use-compiled/__tests__/imports.test.tsx +0 -158
  126. package/src/rules/use-compiled/__tests__/keyframes.test.tsx +0 -140
  127. package/src/rules/use-compiled/__tests__/pragma.test.tsx +0 -108
  128. package/src/rules/use-compiled/__tests__/styled.test.tsx +0 -114
  129. package/src/rules/use-compiled/__tests__/use-compiled.test.tsx +0 -15
  130. package/src/rules/use-compiled/index.tsx +0 -252
  131. package/src/rules/use-compiled/is-safe.tsx +0 -159
  132. package/src/rules/use-compiled/utils.tsx +0 -33
  133. package/src/rules/utils/create-rule-with-typed-config.tsx +0 -86
  134. package/src/rules/utils/create-rule.tsx +0 -13
  135. package/tsconfig.app.json +0 -47
  136. package/tsconfig.dev.json +0 -45
  137. package/tsconfig.json +0 -25
@@ -1,243 +0,0 @@
1
- import { tester } from '../../__tests__/utils/_tester';
2
- import rule from '../index';
3
-
4
- tester.run('enforce-style-prop', rule, {
5
- valid: [
6
- {
7
- name: 'No style attribute used',
8
- code: `
9
- <div css={styles} />
10
- `,
11
- },
12
- {
13
- name: 'Values from props are acceptable',
14
- code: `
15
- function Component(props) {
16
- return <div
17
- style={{
18
- width: props.width,
19
- '--my-nested-width': props.width,
20
- }}
21
- css={css({ margin: 0, color: 'red' })}
22
- />
23
- }
24
- `,
25
- },
26
- {
27
- name: 'Values from deconstructed props are acceptable',
28
- code: `
29
- function DeconstructionComponent1({ myWidth }) {
30
- return <div style={{ width: myWidth }}>hello</div>;
31
- }
32
- `,
33
- },
34
- {
35
- name: 'Multiple values from deconstructed props are acceptable',
36
- code: `
37
- function DeconstructionComponent2({ myWidth, height, myColor = '#fff' }) {
38
- return <div style={{ width: myWidth, height, color: myColor }}>hello</div>;
39
- }
40
- `,
41
- },
42
- {
43
- name: 'Skips linting @media query as it is not supported by the style prop anyways',
44
- code: `
45
- function Component() {
46
- return <div
47
- style={{
48
- '@media …': { /* ... */ },
49
- }}
50
- />
51
- }
52
- `,
53
- },
54
- {
55
- name: 'Skips linting selector as it is not supported by the style prop anyways',
56
- code: `
57
- function Component() {
58
- return <div
59
- style={{
60
- 'button': { /* ... */ },
61
- }}
62
- />
63
- }
64
- `,
65
- },
66
- {
67
- name: 'Static styles are outside of style attribute',
68
- code: `
69
- function Component(props) {
70
- return (
71
- <div
72
- style={{
73
- width: props.width,
74
- }}
75
- css={css({ margin: 0, color: 'red' })}
76
- />
77
- );
78
- }
79
- `,
80
- },
81
- {
82
- name: 'Props destructured in function via object pattern',
83
- code: `
84
- function Component(props) {
85
- const { width } = props;
86
- return <div style={{ width: width }} />
87
- }
88
- `,
89
- },
90
- {
91
- name: 'Props destructured in function via member expression',
92
- code: `
93
- function Component(props) {
94
- const width = props.width;
95
- return <div style={{ width: width }} />
96
- }
97
- `,
98
- },
99
- {
100
- name: 'Ignore state variables',
101
- code: `
102
- const Component = () => {
103
- const [state, setState] = useState();
104
- return <div style={{ width: state.width }} />
105
- };
106
- `,
107
- },
108
- {
109
- name: 'Ignore variables initialised by call expression',
110
- code: `
111
- const Component = () => {
112
- const tableWidth = calcDefaultLayoutWidthByAppearance(
113
- rendererAppearance,
114
- tableNode,
115
- );
116
- return (
117
- <div style={{ width: tableWidth }} />
118
- )
119
- }
120
- `,
121
- },
122
- {
123
- name: 'Property from object initialisation is ok',
124
- code: `
125
- function Component(props) {
126
- const obj = { width: 0 };
127
- return <div
128
- style={{
129
- width: obj.width
130
- }}
131
- />
132
- }
133
- `,
134
- },
135
- {
136
- name: 'Let variables are ok',
137
- code: `
138
- function Component(props) {
139
- let width = 0;
140
- return <div
141
- style={{
142
- width
143
- }}
144
- />
145
- }
146
- `,
147
- },
148
- {
149
- name: 'Ignore function calls',
150
- code: `
151
- import { calcDefaultLayoutWidthByAppearance } from '../shared';
152
- const Component = () => {
153
- return (
154
- <div
155
- style={{
156
- width: calcDefaultLayoutWidthByAppearance(
157
- rendererAppearance,
158
- tableNode,
159
- ),
160
- }}
161
- />
162
- );
163
- };
164
- `,
165
- },
166
- ],
167
- invalid: [
168
- {
169
- name: 'Basic test for static css values',
170
- code: `
171
- function Component(props) {
172
- return <div
173
- style={{
174
- margin: 0,
175
- color: 'red',
176
- }}
177
- />
178
- }
179
- `,
180
- errors: [{ messageId: 'enforce-style-prop' }, { messageId: 'enforce-style-prop' }],
181
- },
182
- {
183
- name: 'No constants passed to style',
184
- code: `
185
- function Component(props) {
186
- const color = 'red';
187
- return <div
188
- style={{
189
- color, // should be static css
190
- }}
191
- />
192
- }
193
- `,
194
- errors: [{ messageId: 'enforce-style-prop' }],
195
- },
196
- {
197
- name: 'No spread operator within style',
198
- code: `
199
- import importedStyleObj from '../shared';
200
- function Component(props) {
201
- const color = 'red';
202
- return <div
203
- style={{
204
- ...importedStyleObj,
205
- ...props.style
206
- }}
207
- />
208
- }
209
- `,
210
- errors: [{ messageId: 'enforce-style-prop' }, { messageId: 'enforce-style-prop' }],
211
- },
212
- {
213
- name: 'No imported object passed to style',
214
- code: `
215
- import importedStyleObj from '../shared';
216
- function AnotherComponent() {
217
- return <div style={importedStyleObj} />;
218
- }
219
- `,
220
- errors: [{ messageId: 'enforce-style-prop' }],
221
- },
222
- {
223
- name: 'No rest prop',
224
- code: `
225
- function Component({ prop1, ...spreadElement }) {
226
- return <div style={{ 'button': spreadElement }}>hello</div>
227
- }
228
- `,
229
- errors: [{ messageId: 'enforce-style-prop' }],
230
- },
231
- {
232
- name: 'No token calls',
233
- code: `
234
- import { token } from '@atlaskit/tokens';
235
-
236
- function Component() {
237
- return <div style={{ paddingBottom: token('space.150', '12px') }} />;
238
- }
239
- `,
240
- errors: [{ messageId: 'enforce-style-prop' }],
241
- },
242
- ],
243
- });
@@ -1,172 +0,0 @@
1
- import { type Identifier, isNodeOfType, type Node } from 'eslint-codemod-utils';
2
- import type { SpreadElement, Property } from 'estree-jsx';
3
-
4
- import { createLintRule } from '../utils/create-rule';
5
- import type { Rule, Scope } from 'eslint';
6
- import {
7
- getAllowedFunctionCalls,
8
- isAllowListedVariable,
9
- } from '@atlaskit/eslint-utils/allowed-function-calls';
10
- import { findVariable } from '@atlaskit/eslint-utils/find-variable';
11
-
12
- type ObjPropertyType = Property | SpreadElement;
13
- type IdentifierWithParent = Scope.Reference['identifier'] & Rule.NodeParentExtension;
14
-
15
- const isParameter = (context: Rule.RuleContext, identifier: Identifier): boolean => {
16
- const definitions = findVariable({
17
- sourceCode: context.getSourceCode(),
18
- identifier: identifier,
19
- })?.defs;
20
- if (!definitions || !definitions.length) {
21
- return false;
22
- }
23
-
24
- const result = definitions[0];
25
- return result.type === 'Parameter';
26
- };
27
-
28
- const isIdentifierAllowed = (context: Rule.RuleContext, identifier: Identifier): boolean => {
29
- const variable = findVariable({
30
- sourceCode: context.getSourceCode(),
31
- identifier: identifier,
32
- });
33
-
34
- if (!variable) {
35
- return false;
36
- }
37
-
38
- const variableDefinition = variable.defs[0].node;
39
-
40
- // If identifier is a RestElement, report warning
41
- if ((variable.identifiers[0] as IdentifierWithParent).parent?.type === 'RestElement') {
42
- return false;
43
- }
44
-
45
- // Checking if identifier has been destructured from props within function
46
- if (variableDefinition.type === 'VariableDeclarator') {
47
- // If it's a let variable, ignore
48
- if (variableDefinition.parent.kind === 'let') {
49
- return true;
50
- }
51
- // If it's initialised by a call expression, ignore
52
- if (variableDefinition.init?.type === 'CallExpression') {
53
- return true;
54
- }
55
- // Destructured from member expression
56
- // e.g. const width = props.width
57
- if (variableDefinition.init?.type === 'MemberExpression') {
58
- return isParameter(context, variableDefinition.init.object);
59
- }
60
- // Destructured from object pattern
61
- // e.g. const { width } = props
62
- return isParameter(context, variableDefinition.init);
63
- }
64
- // If identifier has not been deconstructed from parameter or is a RestElement, report warning
65
- return isParameter(context, identifier);
66
- };
67
-
68
- function isPropertyValueAllowed(property: ObjPropertyType, context: Rule.RuleContext): boolean {
69
- if (property.type === 'SpreadElement') {
70
- return false;
71
- }
72
- // property.type === 'Property', moving on to check if value is static
73
- if (property.value.type === 'Literal') {
74
- return false;
75
- } else if (property.value.type === 'Identifier') {
76
- return isIdentifierAllowed(context, property.value);
77
- } else if (
78
- property.value.type === 'CallExpression' &&
79
- property.value.callee.type === 'Identifier'
80
- ) {
81
- const variable = findVariable({
82
- sourceCode: context.getSourceCode(),
83
- identifier: property.value.callee,
84
- });
85
- // Anything returned by getAllowedFunctionCalls should be used in css prop instead
86
- const functionAllowList = getAllowedFunctionCalls(context.options);
87
- if (
88
- !variable ||
89
- isAllowListedVariable({
90
- allowList: functionAllowList,
91
- variable,
92
- })
93
- ) {
94
- return false;
95
- }
96
- } else if (
97
- property.value.type === 'MemberExpression' &&
98
- property.value.object.type === 'Identifier'
99
- ) {
100
- const definitions = findVariable({
101
- sourceCode: context.getSourceCode(),
102
- identifier: property.value.object,
103
- })?.defs;
104
- if (!definitions || !definitions.length) {
105
- return false;
106
- }
107
- const variable = definitions[0];
108
- if (!variable) {
109
- return false;
110
- }
111
- const varType = variable.type;
112
-
113
- if (varType === 'Variable') {
114
- if (!variable.node.init) {
115
- return false;
116
- }
117
- const varSource = variable.node.init.type;
118
- // Variables initialised by a call expression or object expression are ok
119
- if (varSource === 'CallExpression' || varSource === 'ObjectExpression') {
120
- return true;
121
- }
122
- // Check if member expression matches with function argument
123
- } else if (varType !== 'Parameter') {
124
- return false;
125
- }
126
- }
127
- return true;
128
- }
129
-
130
- export const rule = createLintRule({
131
- meta: {
132
- name: 'enforce-style-prop',
133
- docs: {
134
- description: 'Disallows usage of static styles in the `style` attribute in components',
135
- recommended: true,
136
- severity: 'error',
137
- },
138
- messages: {
139
- 'enforce-style-prop':
140
- 'Avoid adding static values to the style prop. Use the css prop for static styles instead.',
141
- },
142
- type: 'problem',
143
- },
144
- create(context) {
145
- return {
146
- 'JSXAttribute[name.name="style"] > JSXExpressionContainer': (node: Node) => {
147
- if (!isNodeOfType(node, 'JSXExpressionContainer')) {
148
- return;
149
- }
150
- // we've reached an attribute named style
151
-
152
- if (node.expression.type === 'ObjectExpression') {
153
- node.expression.properties.forEach((value) => {
154
- if (!isPropertyValueAllowed(value, context)) {
155
- context.report({
156
- node: value,
157
- messageId: 'enforce-style-prop',
158
- });
159
- }
160
- });
161
- } else {
162
- context.report({
163
- node: node,
164
- messageId: 'enforce-style-prop',
165
- });
166
- }
167
- },
168
- };
169
- },
170
- });
171
-
172
- export default rule;
@@ -1,177 +0,0 @@
1
- import type { LintRuleMeta } from '@atlaskit/eslint-utils/create-rule';
2
- import { getRuleUrl } from './utils/create-rule';
3
-
4
- /** External rules must be scoped, have a display name, and external urls. */
5
- export type ExternalRuleMeta = LintRuleMeta & {
6
- isExternal: true;
7
- name: `@${string}/${string}`;
8
- displayName: string;
9
- docs: { externalUrl: `https://${string}` };
10
- };
11
-
12
- const importSources: readonly string[] = [
13
- '@compiled/react',
14
- '@atlaskit/css',
15
- '@emotion/core',
16
- '@emotion/react',
17
- '@emotion/styled',
18
- 'styled-components',
19
- ];
20
-
21
- export const externalRules: ExternalRuleMeta[] = [
22
- {
23
- name: '@atlaskit/design-system/consistent-css-prop-usage',
24
- displayName: 'consistent-css-prop-usage',
25
- isExternal: true,
26
- fixable: 'code',
27
- docs: {
28
- description: 'Ensures consistency with `css` and `xcss` prop usages',
29
- url: getRuleUrl('consistent-css-prop-usage'),
30
- externalUrl:
31
- 'https://atlassian.design/components/eslint-plugin-design-system/consistent-css-prop-usage/usage',
32
- recommended: true,
33
- severity: 'error',
34
- pluginConfig: {
35
- // When passing a css prop to a React component, we don't know whether the component
36
- // is Emotion or Compiled. Hence it is not safe to run autofixes like wrapping it in
37
- // a `css` function call.
38
- excludeReactComponents: true,
39
- // Ensures that `xcss` prop is still linted even when `excludeReactComponents` is `true`.
40
- shouldAlwaysCheckXcss: true,
41
- },
42
- },
43
- },
44
- {
45
- name: '@atlaskit/design-system/no-css-tagged-template-expression',
46
- displayName: 'no-css-tagged-template-expression',
47
- isExternal: true,
48
- fixable: 'code',
49
- docs: {
50
- description:
51
- 'Disallows any `css` tagged template expressions that originate from Emotion, Styled Components or Compiled',
52
- url: getRuleUrl('no-css-tagged-template-expression'),
53
- externalUrl:
54
- 'https://atlassian.design/components/eslint-plugin-design-system/no-css-tagged-template-expression/usage',
55
- recommended: true,
56
- severity: 'error',
57
- },
58
- },
59
- {
60
- name: '@atlaskit/design-system/no-keyframes-tagged-template-expression',
61
- displayName: 'no-keyframes-tagged-template-expression',
62
- isExternal: true,
63
- fixable: 'code',
64
- docs: {
65
- description:
66
- 'Disallows any `keyframe` tagged template expressions that originate from Emotion, Styled Components or Compiled',
67
- url: getRuleUrl('no-keyframes-tagged-template-expression'),
68
- externalUrl:
69
- 'https://atlassian.design/components/eslint-plugin-design-system/no-keyframes-tagged-template-expression/usage',
70
- recommended: true,
71
- severity: 'error',
72
- },
73
- },
74
- {
75
- name: '@atlaskit/design-system/no-styled-tagged-template-expression',
76
- displayName: 'no-styled-tagged-template-expression',
77
- isExternal: true,
78
- fixable: 'code',
79
- docs: {
80
- description:
81
- 'Disallows any `styled` tagged template expressions that originate from Emotion, Styled Components or Compiled',
82
- url: getRuleUrl('no-styled-tagged-template-expression'),
83
- externalUrl:
84
- 'https://atlassian.design/components/eslint-plugin-design-system/no-styled-tagged-template-expression/usage',
85
- recommended: true,
86
- severity: 'error',
87
- },
88
- },
89
- {
90
- name: '@compiled/no-suppress-xcss',
91
- displayName: 'no-suppress-xcss',
92
- isExternal: true,
93
- docs: {
94
- description: 'Disallows supressing type violations when using the xcss prop.',
95
- url: getRuleUrl('no-suppress-xcss'),
96
- externalUrl:
97
- 'https://github.com/atlassian-labs/compiled/tree/master/packages/eslint-plugin/src/rules/no-suppress-xcss',
98
- recommended: true,
99
- severity: 'error',
100
- },
101
- },
102
- {
103
- name: '@compiled/no-js-xcss',
104
- displayName: 'no-js-xcss',
105
- isExternal: true,
106
- docs: {
107
- description: 'Disallows using xcss prop inside JavaScript files.',
108
- url: getRuleUrl('no-js-xcss'),
109
- externalUrl:
110
- 'https://github.com/atlassian-labs/compiled/tree/master/packages/eslint-plugin/src/rules/no-js-xcss',
111
- recommended: true,
112
- severity: 'error',
113
- },
114
- },
115
- {
116
- name: '@atlaskit/design-system/no-empty-styled-expression',
117
- displayName: 'no-empty-styled-expression',
118
- isExternal: true,
119
- docs: {
120
- description:
121
- 'Forbids any styled expression to be used when passing empty arguments to styled.div() (or other JSX elements).',
122
- url: getRuleUrl('no-empty-styled-expression'),
123
- externalUrl:
124
- 'https://atlassian.design/components/eslint-plugin-design-system/no-empty-styled-expression/usage',
125
- recommended: true,
126
- severity: 'error',
127
- pluginConfig: { importSources },
128
- },
129
- },
130
- {
131
- name: '@atlaskit/design-system/no-exported-css',
132
- displayName: 'no-exported-css',
133
- isExternal: true,
134
- docs: {
135
- description:
136
- 'Forbid exporting `css` function calls. Exporting `css` function calls can result in unexpected behaviour at runtime, and is not statically analysable.',
137
- url: getRuleUrl('no-exported-css'),
138
- externalUrl:
139
- 'https://atlassian.design/components/eslint-plugin-design-system/no-exported-css/usage',
140
- recommended: true,
141
- severity: 'error',
142
- pluginConfig: { importSources },
143
- },
144
- },
145
- {
146
- name: '@atlaskit/design-system/no-exported-keyframes',
147
- displayName: 'no-exported-keyframes',
148
- isExternal: true,
149
- docs: {
150
- description:
151
- 'Forbid exporting `keyframes` function calls. Exporting `css` function calls can result in unexpected behaviour at runtime, and is not statically analysable.',
152
- url: getRuleUrl('no-exported-keyframes'),
153
- externalUrl:
154
- 'https://atlassian.design/components/eslint-plugin-design-system/no-exported-keyframes/usage',
155
- recommended: true,
156
- severity: 'error',
157
- pluginConfig: { importSources },
158
- },
159
- },
160
- {
161
- name: '@atlaskit/design-system/no-invalid-css-map',
162
- displayName: 'no-invalid-css-map',
163
- isExternal: true,
164
- docs: {
165
- description:
166
- "Checks the validity of a CSS map created through cssMap. This is intended to be used alongside TypeScript's type-checking.",
167
- url: getRuleUrl('no-invalid-css-map'),
168
- externalUrl:
169
- 'https://atlassian.design/components/eslint-plugin-design-system/no-invalid-css-map/usage',
170
- recommended: true,
171
- severity: 'error',
172
- pluginConfig: {
173
- allowedFunctionCalls: [['@atlaskit/tokens', 'token']],
174
- },
175
- },
176
- },
177
- ];
@@ -1,42 +0,0 @@
1
- /**
2
- * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::6ad0de2d4bdac726387f27681ad9fcf4>>
4
- * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
- */
6
- import atlaskitTheme from './atlaskit-theme';
7
- import convertPropsSyntax from './convert-props-syntax';
8
- import enforceStyleProp from './enforce-style-prop';
9
- import localCxXcss from './local-cx-xcss';
10
- import noArrayArguments from './no-array-arguments';
11
- import noClassnameProp from './no-classname-prop';
12
- import noContainerQueries from './no-container-queries';
13
- import noDynamicStyles from './no-dynamic-styles';
14
- import noExportedStyles from './no-exported-styles';
15
- import noGlobalStyles from './no-global-styles';
16
- import noImportantStyles from './no-important-styles';
17
- import noImportedStyleValues from './no-imported-style-values';
18
- import noNestedSelectors from './no-nested-selectors';
19
- import noStyled from './no-styled';
20
- import noUnsafeSelectors from './no-unsafe-selectors';
21
- import noUnsafeValues from './no-unsafe-values';
22
- import useCompiled from './use-compiled';
23
-
24
- export default {
25
- 'atlaskit-theme': atlaskitTheme,
26
- 'convert-props-syntax': convertPropsSyntax,
27
- 'enforce-style-prop': enforceStyleProp,
28
- 'local-cx-xcss': localCxXcss,
29
- 'no-array-arguments': noArrayArguments,
30
- 'no-classname-prop': noClassnameProp,
31
- 'no-container-queries': noContainerQueries,
32
- 'no-dynamic-styles': noDynamicStyles,
33
- 'no-exported-styles': noExportedStyles,
34
- 'no-global-styles': noGlobalStyles,
35
- 'no-important-styles': noImportantStyles,
36
- 'no-imported-style-values': noImportedStyleValues,
37
- 'no-nested-selectors': noNestedSelectors,
38
- 'no-styled': noStyled,
39
- 'no-unsafe-selectors': noUnsafeSelectors,
40
- 'no-unsafe-values': noUnsafeValues,
41
- 'use-compiled': useCompiled,
42
- };
@@ -1,51 +0,0 @@
1
- Blocks the `cx()` function from being used outside of the `xcss` prop. This aids tracking which
2
- styles are applied.
3
-
4
- Use the `cx()` function when passing multiple styles to the `xcss` prop. This provides more robust
5
- type checking than the conventional array syntax:
6
-
7
- ```tsx
8
- import { cssMap, cx } from '@compiled/react';
9
- import { token } from '@atlaskit/tokens';
10
- import { Component } from 'some-package';
11
-
12
- const styles = cssMap({
13
- text: { color: token('color.text') },
14
- primary: { color: token('color.text.brand') },
15
- });
16
-
17
- <Component xcss={cx(isPrimary && styles.text, !isPrimary && styles.primary)} />;
18
- ```
19
-
20
- The `cx()` function is only checked when imported from `@compiled/react` or `@atlaskit/css`.
21
-
22
- ## Examples
23
-
24
- ### Incorrect
25
-
26
- ```tsx
27
- import { cssMap, cx } from '@compiled/react';
28
- import { token } from '@atlaskit/tokens';
29
-
30
- const styles = cssMap({
31
- text: { color: token('color.text') },
32
- bg: { background: token('color.background.neutral') },
33
- });
34
-
35
- const joinedStyles = cx(styles.text, styles.bg);
36
-
37
- <Button xcss={joinedStyles} />;
38
- ```
39
-
40
- ### Correct
41
-
42
- ```tsx
43
- import { cssMap, cx } from '@compiled/react';
44
-
45
- const styles = cssMap({
46
- text: { color: token('color.text') },
47
- bg: { background: token('color.background.neutral') },
48
- });
49
-
50
- <Button xcss={cx(styles.text, styles.bg)} />;
51
- ```