Skip to content

Commit 0d8b904

Browse files
committed
LSPAY-33449: Emotion update
1 parent da4c2da commit 0d8b904

71 files changed

Lines changed: 819 additions & 8088 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ module.exports = {
1616
// See https://github.com/lightspeedretail/web-tools/issues/65
1717
'@typescript-eslint/ban-types': 'error',
1818
'jest/valid-describe': 'off',
19+
// Allow css prop from Emotion v11
20+
'react/no-unknown-property': ['error', { ignore: ['css'] }],
1921
},
2022
overrides: [
2123
{
@@ -24,6 +26,12 @@ module.exports = {
2426
'import/no-extraneous-dependencies': 'off',
2527
},
2628
},
29+
{
30+
files: ['**/*.test.tsx', '**/*.test.ts', '**/__tests__/*.tsx', '**/__tests__/*.ts'],
31+
rules: {
32+
'import/no-extraneous-dependencies': 'off',
33+
},
34+
},
2735
],
2836
settings: {
2937
// Using `export * ...` does not work with eslint-plugin-import and makes ESLint trips,

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
10.16.0
1+
20

.storybook/main.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,17 @@ const babelOptions = {
1616
debug: false,
1717
},
1818
],
19-
'@babel/preset-react',
20-
'@emotion/babel-preset-css-prop',
19+
[
20+
'@babel/preset-react',
21+
{
22+
runtime: 'automatic',
23+
importSource: '@emotion/react',
24+
},
25+
],
2126
],
2227
plugins: [
2328
'@babel/plugin-proposal-object-rest-spread',
24-
'emotion',
29+
'@emotion/babel-plugin',
2530
// need to resolve the dependency differently in storybook.
2631
// It's an issue on their side where they use an old version of
2732
// react-popper which magically clashes with ours

.storybook/preview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { Global } from '@emotion/core';
2+
import { Global } from '@emotion/react';
33
import { addDecorator, addParameters } from '@storybook/react';
44
import { FlameGlobalStyles, FlameTheme, themePicker } from '../packages/flame/src/Core/index.tsx';
55
import './stories.scss';

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ If you have Emotion already installed and you would like to use the theme values
9898
```jsx
9999
import React from 'react';
100100
import { FlameTheme, lightTheme } from '@lightspeed/flame/Core';
101-
import { ThemeProvider } from 'emotion-theming';
101+
import { ThemeProvider } from '@emotion/react';
102102
103103
class App extends React.Component {
104104
render() {

babel.config.js

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,26 @@ module.exports = {
77
},
88
],
99
'@babel/preset-typescript',
10-
'@babel/preset-react',
11-
'@emotion/babel-preset-css-prop',
10+
[
11+
'@babel/preset-react',
12+
{
13+
runtime: 'automatic',
14+
importSource: '@emotion/react',
15+
},
16+
],
1217
],
13-
plugins: ['@babel/plugin-proposal-object-rest-spread'],
18+
plugins: ['@babel/plugin-proposal-object-rest-spread', '@emotion/babel-plugin'],
1419
env: {
1520
test: {
1621
presets: [
1722
'@babel/preset-typescript',
18-
'@babel/preset-react',
23+
[
24+
'@babel/preset-react',
25+
{
26+
runtime: 'automatic',
27+
importSource: '@emotion/react',
28+
},
29+
],
1930
[
2031
'@babel/preset-env',
2132
{
@@ -26,17 +37,19 @@ module.exports = {
2637
},
2738
},
2839
],
29-
'@emotion/babel-preset-css-prop',
3040
],
41+
plugins: ['@emotion/babel-plugin'],
3142
},
3243
// for ESM builds
3344
production: {
34-
plugins: ['transform-react-remove-prop-types'],
45+
plugins: ['transform-react-remove-prop-types', '@emotion/babel-plugin'],
3546
presets: [
47+
'@babel/preset-typescript',
3648
[
37-
'@emotion/babel-preset-css-prop',
49+
'@babel/preset-react',
3850
{
39-
sourceMap: false,
51+
runtime: 'automatic',
52+
importSource: '@emotion/react',
4053
},
4154
],
4255
[
@@ -45,23 +58,23 @@ module.exports = {
4558
modules: false,
4659
},
4760
],
48-
'@babel/preset-typescript',
4961
],
5062
},
5163
cjs: {
52-
plugins: ['transform-react-remove-prop-types'],
64+
plugins: ['transform-react-remove-prop-types', '@emotion/babel-plugin'],
5365
presets: [
5466
'@babel/preset-typescript',
5567
[
56-
'@babel/preset-env',
68+
'@babel/preset-react',
5769
{
58-
modules: 'commonjs',
70+
runtime: 'automatic',
71+
importSource: '@emotion/react',
5972
},
6073
],
6174
[
62-
'@emotion/babel-preset-css-prop',
75+
'@babel/preset-env',
6376
{
64-
sourceMap: false,
77+
modules: 'commonjs',
6578
},
6679
],
6780
],

jest.setup.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
/* eslint-disable import/no-extraneous-dependencies */
22
import '@testing-library/jest-dom';
33
import { cleanup } from '@testing-library/react';
4-
import * as emotion from 'emotion';
5-
import { createSerializer, matchers as emotionMatchers } from 'jest-emotion';
4+
import { matchers } from '@emotion/jest';
65

7-
expect.addSnapshotSerializer(createSerializer(emotion));
8-
expect.extend(emotionMatchers);
6+
expect.extend(matchers);
97

108
afterEach(cleanup);
119

package.json

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535
"percy": "build-storybook -c .storybook && percy-storybook --widths=1280"
3636
},
3737
"dependencies": {
38-
"@emotion/core": "^10.1.1",
39-
"@emotion/styled": "^10.0.27",
38+
"@emotion/cache": "^11.11.0",
39+
"@emotion/react": "^11.11.0",
40+
"@emotion/styled": "^11.11.0",
4041
"@styled-system/css": "^5.1.5",
4142
"@styled-system/theme-get": "5.0.16",
42-
"emotion-theming": "^10.0.27",
4343
"polished": "^2.3.0",
4444
"prop-types": "^15.6.0",
45-
"react": "^16.8.6",
46-
"react-dom": "^16.8.6",
45+
"react": "^18.3.1",
46+
"react-dom": "^18.3.1",
4747
"styled-system": "^5.0.16"
4848
},
4949
"devDependencies": {
@@ -54,7 +54,8 @@
5454
"@babel/preset-react": "^7.0.0",
5555
"@babel/preset-typescript": "^7.1.0",
5656
"@babel/runtime": "^7.0.0",
57-
"@emotion/babel-preset-css-prop": "^10.0.14",
57+
"@emotion/babel-plugin": "^11.11.0",
58+
"@emotion/jest": "^11.11.0",
5859
"@lightspeed/browserslist-config": "^0.1.2",
5960
"@lightspeed/config-prettier": "^0.1.2",
6061
"@lightspeed/config-typescript": "^0.2.0",
@@ -72,12 +73,12 @@
7273
"@types/jest": "^25.2.3",
7374
"@types/lodash": "^4.14.123",
7475
"@types/luxon": "^1.15.2",
76+
"@types/minimatch": "^3.0.3",
7577
"@types/react": "^18.3.26",
7678
"@types/react-test-renderer": "^16.8.3",
7779
"babel-eslint": "^10.0.1",
7880
"babel-jest": "^26.0.1",
7981
"babel-loader": "^8.0.4",
80-
"babel-plugin-emotion": "^10.0.0",
8182
"babel-plugin-module-resolver": "^4.0.0",
8283
"babel-plugin-transform-object-rest-spread": "^6.26.0",
8384
"babel-plugin-transform-react-remove-prop-types": "^0.4.13",
@@ -96,7 +97,6 @@
9697
"husky": "^0.14.3",
9798
"identity-obj-proxy": "^3.0.0",
9899
"jest": "^26.0.1",
99-
"jest-emotion": "^10.0.0",
100100
"lerna": "^3.10.2",
101101
"lint-staged": "^7.1.2",
102102
"plop": "^2.4.0",
@@ -106,10 +106,9 @@
106106
"prettier": "^1.16.1",
107107
"raw-loader": "4.0.1",
108108
"react-docgen-typescript": "~2.2.2",
109-
"react-test-renderer": "^16.8.6",
109+
"react-test-renderer": "^18.3.1",
110110
"sass": "^1.14.3",
111111
"sass-loader": "^7.1.0",
112-
"storybook-readme": "^5.0.8",
113112
"style-loader": "^0.21.0",
114113
"typescript": "^4.9.5",
115114
"webpack": "^4.41.2",
@@ -119,7 +118,14 @@
119118
"resolutions": {
120119
"@types/react": "18.3.26",
121120
"@types/react-dom": "^18.0.0",
122-
"react-docgen-typescript": "~2.2.2"
121+
"react": "18.3.1",
122+
"react-dom": "18.3.1",
123+
"react-docgen-typescript": "~2.2.2",
124+
"@emotion/react": "^11.11.0",
125+
"@emotion/core": "npm:@emotion/react@^11.11.0",
126+
"@emotion/styled": "^11.11.0",
127+
"@emotion/styled-base": "npm:@emotion/styled@^11.11.0",
128+
"emotion-theming": "npm:@emotion/react@^11.11.0"
123129
},
124130
"lint-staged": {
125131
"*.{ts,tsx,js,jsx,json,css,scss,md}": [

packages/flame-tokens/src/__tests__/typography.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { fontSizes, fontSizeAliases } = require('../typography');
1+
const { fontSizes, fontSizeAliases } = require('../typography.ts');
22

33
describe('fontSizes', () => {
44
it('returns list of rem value by size', () => {

packages/flame-tokens/src/__tests__/utils.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { pxToRem } = require('../utils');
1+
const { pxToRem } = require('../utils.ts');
22

33
describe('pxToRem', () => {
44
it('returns rem value with default base value', () => {

0 commit comments

Comments
 (0)