@atlaskit/eslint-plugin-ui-styling-standard 0.7.1 → 0.8.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 (61) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +2 -1
  3. package/constellation/index/overview.mdx +2 -1
  4. package/constellation/no-nested-selectors/usage.mdx +60 -0
  5. package/dist/cjs/presets/all.codegen.js +3 -4
  6. package/dist/cjs/presets/recommended.codegen.js +3 -4
  7. package/dist/cjs/rules/convert-props-syntax/index.js +1 -1
  8. package/dist/cjs/rules/external-rules.js +1 -27
  9. package/dist/cjs/rules/index.codegen.js +4 -2
  10. package/dist/cjs/rules/local-cx-xcss/index.js +1 -1
  11. package/dist/cjs/rules/no-container-queries/index.js +1 -1
  12. package/dist/cjs/rules/no-important-styles/index.js +1 -1
  13. package/dist/cjs/rules/no-nested-selectors/index.js +82 -0
  14. package/dist/es2019/presets/all.codegen.js +3 -4
  15. package/dist/es2019/presets/recommended.codegen.js +3 -4
  16. package/dist/es2019/rules/convert-props-syntax/index.js +1 -1
  17. package/dist/es2019/rules/external-rules.js +1 -27
  18. package/dist/es2019/rules/index.codegen.js +4 -2
  19. package/dist/es2019/rules/local-cx-xcss/index.js +1 -1
  20. package/dist/es2019/rules/no-container-queries/index.js +1 -1
  21. package/dist/es2019/rules/no-important-styles/index.js +1 -1
  22. package/dist/es2019/rules/no-nested-selectors/index.js +71 -0
  23. package/dist/esm/presets/all.codegen.js +3 -4
  24. package/dist/esm/presets/recommended.codegen.js +3 -4
  25. package/dist/esm/rules/convert-props-syntax/index.js +1 -1
  26. package/dist/esm/rules/external-rules.js +1 -27
  27. package/dist/esm/rules/index.codegen.js +4 -2
  28. package/dist/esm/rules/local-cx-xcss/index.js +1 -1
  29. package/dist/esm/rules/no-container-queries/index.js +1 -1
  30. package/dist/esm/rules/no-important-styles/index.js +1 -1
  31. package/dist/esm/rules/no-nested-selectors/index.js +76 -0
  32. package/dist/types/index.codegen.d.ts +4 -6
  33. package/dist/types/presets/all.codegen.d.ts +3 -4
  34. package/dist/types/presets/recommended.codegen.d.ts +3 -4
  35. package/dist/types/rules/index.codegen.d.ts +1 -0
  36. package/dist/types/rules/no-nested-selectors/index.d.ts +2 -0
  37. package/dist/types-ts4.5/index.codegen.d.ts +4 -6
  38. package/dist/types-ts4.5/presets/all.codegen.d.ts +3 -4
  39. package/dist/types-ts4.5/presets/recommended.codegen.d.ts +3 -4
  40. package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
  41. package/dist/types-ts4.5/rules/no-nested-selectors/index.d.ts +2 -0
  42. package/package.json +2 -1
  43. package/src/presets/all.codegen.tsx +3 -13
  44. package/src/presets/recommended.codegen.tsx +3 -13
  45. package/src/rules/convert-props-syntax/index.tsx +4 -1
  46. package/src/rules/external-rules.tsx +0 -30
  47. package/src/rules/index.codegen.tsx +3 -1
  48. package/src/rules/local-cx-xcss/index.tsx +4 -1
  49. package/src/rules/no-container-queries/index.tsx +1 -1
  50. package/src/rules/no-important-styles/index.tsx +1 -1
  51. package/src/rules/no-nested-selectors/README.md +58 -0
  52. package/src/rules/no-nested-selectors/__tests__/rule.test.tsx +236 -0
  53. package/src/rules/no-nested-selectors/index.tsx +115 -0
  54. package/tsconfig.app.json +3 -0
  55. package/dist/cjs/rules/utils/is-supported-import.js +0 -160
  56. package/dist/es2019/rules/utils/is-supported-import.js +0 -150
  57. package/dist/esm/rules/utils/is-supported-import.js +0 -154
  58. package/dist/types/rules/utils/is-supported-import.d.ts +0 -46
  59. package/dist/types-ts4.5/rules/utils/is-supported-import.d.ts +0 -46
  60. package/src/rules/utils/README.md +0 -1
  61. package/src/rules/utils/is-supported-import.tsx +0 -227
@@ -0,0 +1,58 @@
1
+ This rule prevents the usage of the nested selectors in style declarations. Avoid setting styles for any child elements or elements that require context from other elements.
2
+
3
+ ## Examples
4
+
5
+ ### Incorrect
6
+
7
+ ```js
8
+ import { css } from '@compiled/react';
9
+ const styles = css({
10
+ h2: {
11
+ fontSize: '1.5rem',
12
+ },
13
+ });
14
+ ```
15
+
16
+ ```js
17
+ import { styled } from '@compiled/react';
18
+ const Component = styled.div({
19
+ '*': {
20
+ padding: 0,
21
+ },
22
+ });
23
+ ```
24
+
25
+ ```js
26
+ import { styled } from '@compiled/react';
27
+ const Component = styled.div({
28
+ '.myclass': {
29
+ padding: 0,
30
+ },
31
+ });
32
+ ```
33
+
34
+ ### Correct
35
+
36
+ ```js
37
+ import { css } from '@compiled/react';
38
+ const styles = css({
39
+ display: 'flex',
40
+ flexDirection: 'column',
41
+ });
42
+ ```
43
+
44
+ ## Options
45
+
46
+ ### importSources
47
+
48
+ By default, this rule will check `css` usages from:
49
+
50
+ - `@atlaskit/css`
51
+ - `@atlaskit/primitives`
52
+ - `@compiled/react`
53
+ - `@emotion/react`
54
+ - `@emotion/core`
55
+ - `@emotion/styled`
56
+ - `styled-components`
57
+
58
+ To change this list of libraries, you can define a custom set of `importSources`, which accepts an array of package names (strings).
@@ -0,0 +1,236 @@
1
+ import { typescriptEslintTester } from '../../__tests__/utils/_tester';
2
+ import rule from '../index';
3
+
4
+ typescriptEslintTester.run(
5
+ 'no-nested-selectors',
6
+ // @ts-expect-error
7
+ rule,
8
+ {
9
+ valid: [
10
+ {
11
+ name: 'Basic valid test',
12
+ code: `
13
+ import { css } from '@compiled/react';
14
+ const styles = css({
15
+ display: 'flex',
16
+ flexDirection: 'column',
17
+ });
18
+ `,
19
+ },
20
+ {
21
+ name: 'Basic valid test using emotion',
22
+ code: `
23
+ import styled from '@emotion/styled';
24
+ const Container = styled.div({
25
+ display: 'flex',
26
+ flexDirection: 'column'
27
+ })
28
+ `,
29
+ },
30
+ {
31
+ name: 'Custom import sources (subtractive)',
32
+ code: `
33
+ import { css } from '@compiled/react';
34
+ const styles = css({
35
+ h2: {
36
+ fontSize: '1.5rem',
37
+ }
38
+ });
39
+ `,
40
+ options: [
41
+ {
42
+ importSources: [],
43
+ },
44
+ ],
45
+ },
46
+ {
47
+ name: 'Styled div with no selectors',
48
+ code: `
49
+ import { styled } from '@compiled/react';
50
+ const Component = styled.div({
51
+ padding: 0,
52
+ display: 'flex',
53
+ flexDirection: 'column',
54
+ boxSizing: 'border-box',
55
+ });
56
+ `,
57
+ },
58
+ {
59
+ name: 'Pseudo element selectors',
60
+ code: `
61
+ import { styled } from '@compiled/react';
62
+ const Component = styled.div({
63
+ '&:hover': {
64
+ color: 'red'
65
+ },
66
+ '&:focus, :last-child': {
67
+ color: 'yellow'
68
+ },
69
+ '&:first-of-type:last-child': {
70
+ color: 'green'
71
+ },
72
+ });
73
+ `,
74
+ },
75
+ {
76
+ name: 'Next sibling selector on non-HTML element',
77
+ code: `
78
+ import { styled } from '@compiled/react';
79
+ styled.div({
80
+ '& + &': {
81
+ color: 'orange'
82
+ }
83
+ });
84
+ `,
85
+ },
86
+ {
87
+ name: 'Subsequent sibling selector on non-HTML element',
88
+ code: `
89
+ import { styled } from '@compiled/react';
90
+ styled.div({
91
+ '& ~ &': {
92
+ color: 'orange'
93
+ }
94
+ });
95
+ `,
96
+ },
97
+ ],
98
+ invalid: [
99
+ {
100
+ name: 'Universal selector',
101
+ code: `
102
+ import { styled } from '@compiled/react';
103
+ const Component = styled.div({
104
+ '*': {
105
+ padding: 0,
106
+ }
107
+ });
108
+ `,
109
+ errors: [{ messageId: 'no-nested-selectors' }],
110
+ },
111
+ {
112
+ name: 'Class selector',
113
+ code: `
114
+ import { styled } from '@compiled/react';
115
+ const Component = styled.div({
116
+ '.myclass': {
117
+ padding: 0,
118
+ }
119
+ });
120
+ `,
121
+ errors: [{ messageId: 'no-nested-selectors' }],
122
+ },
123
+ {
124
+ name: 'ID selector',
125
+ code: `
126
+ import { styled } from '@compiled/react';
127
+ const Component = styled.div({
128
+ '#myid': {
129
+ padding: 0,
130
+ }
131
+ });
132
+ `,
133
+ errors: [{ messageId: 'no-nested-selectors' }],
134
+ },
135
+ {
136
+ name: 'HTML element selector',
137
+ code: `
138
+ import { styled } from '@compiled/react';
139
+ const Component = styled.div({
140
+ h2: {
141
+ fontSize: '1.5rem',
142
+ }
143
+ });
144
+ `,
145
+ errors: [{ messageId: 'no-nested-selectors' }],
146
+ },
147
+ {
148
+ name: 'Data-component-selector',
149
+ code: `
150
+ import { styled } from '@compiled/react';
151
+ const Component = styled.div({
152
+ '[data-component-selector="my.button"]': {
153
+ color: 'blue',
154
+ },
155
+ });
156
+ `,
157
+ errors: [{ messageId: 'no-nested-selectors' }],
158
+ },
159
+ {
160
+ name: 'Grouping selector',
161
+ code: `
162
+ import { styled } from '@compiled/react';
163
+ const Component = styled.div({
164
+ 'div, p, span': {
165
+ fontSize: '1.5rem',
166
+ },
167
+ color: 'blue',
168
+ backgroundColor: 'red',
169
+ });
170
+ `,
171
+ errors: [{ messageId: 'no-nested-selectors' }],
172
+ },
173
+ {
174
+ name: 'Selector including a variable',
175
+ code: `
176
+ import { styled } from '@compiled/react';
177
+ styled.div({
178
+ [\`\${SOME_VAR} > *\`]: {
179
+ color: 'red'
180
+ },
181
+ });
182
+ `,
183
+ errors: [{ messageId: 'no-nested-selectors' }],
184
+ },
185
+ {
186
+ name: 'Current element selector',
187
+ code: `
188
+ import { styled } from '@compiled/react';
189
+ styled.div({
190
+ color: 'darkorchid',
191
+ '.name &': {
192
+ color: 'orange'
193
+ }
194
+ });
195
+ `,
196
+ errors: [{ messageId: 'no-nested-selectors' }],
197
+ },
198
+ {
199
+ name: 'Child combinator',
200
+ code: `
201
+ import { styled } from '@compiled/react';
202
+ styled.div({
203
+ '& > &': {
204
+ color: 'orange'
205
+ }
206
+ });
207
+ `,
208
+ errors: [{ messageId: 'no-nested-selectors' }],
209
+ },
210
+ {
211
+ name: 'Column combinator',
212
+ code: `
213
+ import { styled } from '@compiled/react';
214
+ styled.div({
215
+ 'col.selected||td': {
216
+ color: 'orange'
217
+ }
218
+ });
219
+ `,
220
+ errors: [{ messageId: 'no-nested-selectors' }],
221
+ },
222
+ {
223
+ name: 'Namespace selector',
224
+ code: `
225
+ import { styled } from '@compiled/react';
226
+ styled.div({
227
+ 'myNameSpace|a': {
228
+ color: 'orange'
229
+ }
230
+ });
231
+ `,
232
+ errors: [{ messageId: 'no-nested-selectors' }],
233
+ },
234
+ ],
235
+ },
236
+ );
@@ -0,0 +1,115 @@
1
+ import type { Property } from 'estree';
2
+
3
+ import {
4
+ isStyled,
5
+ isCss,
6
+ isKeyframes,
7
+ isCssMap,
8
+ isXcss,
9
+ getImportSources,
10
+ } from '@atlaskit/eslint-utils/is-supported-import';
11
+ import { createLintRule } from '../utils/create-rule';
12
+ import { JSONSchema4 } from '@typescript-eslint/utils/dist/json-schema';
13
+
14
+ const schema: JSONSchema4 = [
15
+ {
16
+ type: 'object',
17
+ properties: {
18
+ importSources: {
19
+ type: 'array',
20
+ items: { type: 'string' },
21
+ uniqueItems: true,
22
+ },
23
+ },
24
+ },
25
+ ];
26
+
27
+ const getCssSelector = (node: Property): string | null => {
28
+ if (node.key.type === 'Literal' && typeof node.key.value === 'string') {
29
+ return node.key.value;
30
+ }
31
+
32
+ if (node.key.type === 'Identifier' && typeof node.key.name === 'string') {
33
+ return node.key.name;
34
+ }
35
+
36
+ if (node.key.type === 'TemplateLiteral') {
37
+ return node.key.quasis.map((quasi) => quasi.value.raw).join(' ');
38
+ }
39
+
40
+ return null;
41
+ };
42
+
43
+ export const rule = createLintRule({
44
+ meta: {
45
+ name: 'no-nested-selectors',
46
+ docs: {
47
+ description: 'Prevents usage of nested selectors within css styling',
48
+ recommended: true,
49
+ severity: 'warn',
50
+ },
51
+ messages: {
52
+ 'no-nested-selectors':
53
+ 'Please avoid setting styles for child elements or elements that require context from other elements.',
54
+ },
55
+ type: 'problem',
56
+ schema,
57
+ },
58
+ create(context) {
59
+ const importSources = getImportSources(context);
60
+ return {
61
+ 'CallExpression Property': (node: Property): void => {
62
+ const { references } = context.getScope();
63
+ const ancestors = context.getAncestors();
64
+
65
+ if (
66
+ ancestors.every(
67
+ (ancestor) =>
68
+ ancestor.type !== 'CallExpression' ||
69
+ !ancestor?.callee ||
70
+ !(
71
+ isCss(ancestor.callee, references, importSources) ||
72
+ isStyled(ancestor.callee, references, importSources) ||
73
+ isKeyframes(ancestor.callee, references, importSources) ||
74
+ isCssMap(ancestor.callee, references, importSources) ||
75
+ isXcss(ancestor.callee, references, importSources)
76
+ ),
77
+ )
78
+ ) {
79
+ return;
80
+ }
81
+
82
+ if (node.value.type !== 'ObjectExpression') {
83
+ // If the value is a CSS object, safe to assume we're at a CSS selector
84
+ return;
85
+ }
86
+
87
+ const cssSelector = getCssSelector(node);
88
+ if (cssSelector === null) {
89
+ return;
90
+ }
91
+
92
+ const tokens = cssSelector.split(/[, ]+/);
93
+
94
+ if (
95
+ !tokens.every(
96
+ (token) =>
97
+ token.length === 0 ||
98
+ token.startsWith('&') ||
99
+ token.startsWith(':') ||
100
+ token.includes('+') ||
101
+ token.includes('~') ||
102
+ token.endsWith('&'),
103
+ )
104
+ ) {
105
+ context.report({
106
+ messageId: 'no-nested-selectors',
107
+ node: node.key,
108
+ });
109
+ }
110
+ },
111
+ };
112
+ },
113
+ });
114
+
115
+ export default rule;
package/tsconfig.app.json CHANGED
@@ -33,6 +33,9 @@
33
33
  "outDir": "../../../tsDist/@atlaskit__eslint-plugin-ui-styling-standard/app"
34
34
  },
35
35
  "references": [
36
+ {
37
+ "path": "../eslint-utils/tsconfig.app.json"
38
+ },
36
39
  {
37
40
  "path": "../codegen/tsconfig.app.json"
38
41
  }
@@ -1,160 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isXcss = exports.isStyledComponents = exports.isStyled = exports.isKeyframes = exports.isImportedFrom = exports.isEmotion = exports.isCxFunction = exports.isCssMap = exports.isCss = exports.isCompiled = exports.getImportSources = exports.DEFAULT_IMPORT_SOURCES = exports.CSS_IN_JS_IMPORTS = void 0;
7
- // This should be kept in sync with
8
- // packages/design-system/eslint-plugin/src/rules/utils/is-supported-import.tsx
9
- // whenever possible.
10
- //
11
- // TODO: would having an @atlassian/eslint-plugin-design-system-common
12
- // package be useful?
13
-
14
- // eslint-disable-next-line import/no-extraneous-dependencies
15
-
16
- var CSS_IN_JS_IMPORTS = exports.CSS_IN_JS_IMPORTS = {
17
- compiled: '@compiled/react',
18
- emotionReact: '@emotion/react',
19
- emotionCore: '@emotion/core',
20
- emotionStyled: '@emotion/styled',
21
- styledComponents: 'styled-components',
22
- atlaskitCss: '@atlaskit/css',
23
- atlaskitPrimitives: '@atlaskit/primitives'
24
- };
25
-
26
- // A CSS-in-JS library an import of a valid css, cx, cssMap, etc.
27
- // function might originate from, e.g. @compiled/react, @emotion/core.
28
-
29
- /**
30
- * By default all known import sources are checked against.
31
- */
32
- var DEFAULT_IMPORT_SOURCES = exports.DEFAULT_IMPORT_SOURCES = Object.values(CSS_IN_JS_IMPORTS);
33
- var getIdentifierNode = function getIdentifierNode(node) {
34
- var identifierNode = node.type === 'Identifier' ? node : undefined;
35
- if (!identifierNode) {
36
- // Handles styled.div`` case
37
- if (node.type === 'MemberExpression' && node.object.type === 'Identifier') {
38
- identifierNode = node.object;
39
- }
40
-
41
- // Handles styled(Component)`` case
42
- if (node.type === 'CallExpression' && node.callee.type === 'Identifier') {
43
- identifierNode = node.callee;
44
- }
45
- }
46
- return identifierNode;
47
- };
48
-
49
- /**
50
- * Given the ESLint rule context, extract and parse the value of the importSources rule option.
51
- * The importSources option is used to override which libraries an ESLint rule applies to.
52
- *
53
- * @param context The rule context.
54
- * @returns An array of strings representing what CSS-in-JS packages that should be checked, based
55
- * on the rule options configuration.
56
- */
57
- var getImportSources = exports.getImportSources = function getImportSources(context) {
58
- var options = context.options;
59
- if (!options.length) {
60
- return DEFAULT_IMPORT_SOURCES;
61
- }
62
- if (options[0].importSources && Array.isArray(options[0].importSources)) {
63
- return options[0].importSources;
64
- }
65
- return DEFAULT_IMPORT_SOURCES;
66
- };
67
- var isSupportedImportWrapper = function isSupportedImportWrapper(functionName) {
68
- var defaultFromImportSources = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
69
- var checkDefinitionHasImport = function checkDefinitionHasImport(def, importSources) {
70
- if (def.type !== 'ImportBinding') {
71
- return false;
72
- }
73
- if (!def.parent || !importSources.includes(def.parent.source.value)) {
74
- return false;
75
- }
76
-
77
- // Matches the imported name from a named import
78
- // import { functionName, functioName as otherName } from 'import-source';
79
- var isNamedImport = def.node.type === 'ImportSpecifier' && def.node.imported.name === functionName;
80
-
81
- // Must explicitly match the local name from a default import
82
- // import functionName from 'import-source';
83
- var isDefaultImportMatchingLocal = def.node.type === 'ImportDefaultSpecifier' && def.node.local.name === functionName;
84
-
85
- // Can match any local name from a default import
86
- // import anything from 'import-source'
87
- var isKnownDefaultImport = def.node.type === 'ImportDefaultSpecifier' && defaultFromImportSources.includes(def.parent.source.value);
88
- return isNamedImport || isDefaultImportMatchingLocal || isKnownDefaultImport;
89
- };
90
-
91
- /**
92
- * Checks whether:
93
- *
94
- * 1. A function name `nodeToCheck` matches the name of the function we
95
- * want to check for (e.g. `cx`, `css`, `cssMap`, or `keyframes`), and
96
- * 2. Whether `nodeToCheck` originates from one of the libraries listed
97
- * in `importSources`.
98
- *
99
- * @param nodeToCheck The function callee we are checking (e.g. The `css` in `css()`).
100
- * @param referencesInScope List of references that are in scope. We'll use this
101
- * to check where the function callee is imported from.
102
- * @param importSources List of libraries that we want to ensure `nodeToCheck`
103
- * comes from.
104
- *
105
- * @returns Whether the above conditions are true.
106
- */
107
- var isSupportedImport = function isSupportedImport(nodeToCheck, referencesInScope, importSources) {
108
- var identifierNode = getIdentifierNode(nodeToCheck);
109
- return (identifierNode === null || identifierNode === void 0 ? void 0 : identifierNode.type) === 'Identifier' && referencesInScope.some(function (reference) {
110
- var _reference$resolved;
111
- return reference.identifier === identifierNode && ((_reference$resolved = reference.resolved) === null || _reference$resolved === void 0 ? void 0 : _reference$resolved.defs.some(function (def) {
112
- return checkDefinitionHasImport(def, importSources);
113
- }));
114
- });
115
- };
116
- return isSupportedImport;
117
- };
118
-
119
- // Unused functions have been commented out until we implement corresponding
120
- // eslint rules which use them
121
- //
122
- var isCss = exports.isCss = isSupportedImportWrapper('css');
123
- var isCxFunction = exports.isCxFunction = isSupportedImportWrapper('cx');
124
- var isCssMap = exports.isCssMap = isSupportedImportWrapper('cssMap');
125
- var isKeyframes = exports.isKeyframes = isSupportedImportWrapper('keyframes');
126
- // `styled` is also the explicit default of `styled-components` and `@emotion/styled`, so we also match on default imports generally
127
- var isStyled = exports.isStyled = isSupportedImportWrapper('styled', ['styled-components', '@emotion/styled']);
128
- var isXcss = exports.isXcss = isSupportedImportWrapper('xcss');
129
- var isImportedFrom = exports.isImportedFrom = function isImportedFrom(moduleName) {
130
- var exactMatch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
131
- return function (nodeToCheck, referencesInScope) {
132
- var importSources = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
133
- if (importSources && !importSources.some(function (importSource) {
134
- return importSource === moduleName || !exactMatch && importSource.startsWith(moduleName);
135
- })) {
136
- // Don't go through the trouble of checking the import sources does not include this
137
- // We'll assume this is skipped elsewhere.
138
- return false;
139
- }
140
- var identifierNode = getIdentifierNode(nodeToCheck);
141
- return (identifierNode === null || identifierNode === void 0 ? void 0 : identifierNode.type) === 'Identifier' && referencesInScope.some(function (reference) {
142
- var _reference$resolved2;
143
- return reference.identifier === identifierNode && ((_reference$resolved2 = reference.resolved) === null || _reference$resolved2 === void 0 ? void 0 : _reference$resolved2.defs.some(function (def) {
144
- var _def$parent, _String, _def$parent2;
145
- return def.type === 'ImportBinding' && (((_def$parent = def.parent) === null || _def$parent === void 0 ? void 0 : _def$parent.source.value) === moduleName || !exactMatch && ((_String = String((_def$parent2 = def.parent) === null || _def$parent2 === void 0 ? void 0 : _def$parent2.source.value)) === null || _String === void 0 ? void 0 : _String.startsWith(moduleName)));
146
- }));
147
- });
148
- };
149
- };
150
-
151
- /**
152
- * Determine if this node is specifically from a `'styled-components'` import.
153
- * This is because `styled-components@3.4` APIs are not consistent with Emotion and Compiled,
154
- * we need to handle them differently in a few scenarios.
155
- *
156
- * This can be cleaned up when `'styled-components'` is no longer a valid ImportSource.
157
- */
158
- var isStyledComponents = exports.isStyledComponents = isImportedFrom('styled-components');
159
- var isCompiled = exports.isCompiled = isImportedFrom('@compiled/', false);
160
- var isEmotion = exports.isEmotion = isImportedFrom('@emotion/', false);