You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extend jsx-pragma eslint rule: detect mixing Compiled with Emotion, and only run if importing Compiled (#1551)
* Extend jsx-pragma to support onlyRunIfImportingCompiled and detectConflictWithOtherLibraries
* Raise linting error when Compiled styled API is mixed with Emotion
* Add changeset
* Restore xcss tests
Add detectConflictWithOtherLibraries and onlyRunIfImportingCompiled config options to jsx-pragma ESLint rule. Both are set to true by default, hence the breaking change.
8
+
9
+
`detectConflictWithOtherLibraries` raises a linting error if `css` or `jsx` is imported from `@emotion/react` (or `@emotion/core`) in the same file
10
+
as a Compiled import. Set to true by default.
11
+
12
+
`onlyRunIfImportingCompiled` sets this rule to only suggest adding the JSX pragma if the `css` or `cssMap` functions are imported from `@compiled/react`, as opposed to whenever the `css` attribute is detected at all. Set to false by default.
'Use of the jsxImportSource pragma (automatic runtime) is preferred over the jsx pragma (classic runtime).',
85
117
preferJsx:
86
118
'Use of the jsx pragma (classic runtime) is preferred over the jsx pragma (automatic runtime).',
119
+
emotionAndCompiledConflict:
120
+
"You can't have css/styled/jsx be imported from both Emotion and Compiled in the same file - this will cause type-checking and runtime errors. Consider changing all of your Emotion imports from `@emotion/react` to `@compiled/react`.",
0 commit comments