Skip to content

Commit 73073f3

Browse files
committed
Merge branch 'main' into ts-migration
# Conflicts: # .prettierrc.yaml # flow-typed/npm/jest-glamor-react_vx.x.x.js # flow-typed/npm/jest_v25.x.x.js # packages/babel-plugin/src/emotion-macro.js # packages/babel-plugin/src/index.js # packages/css/src/create-instance.js # packages/jest/src/create-serializer.js # packages/react/src/class-names.js # packages/react/src/context.js # packages/react/src/global.js # packages/react/src/jsx.js # packages/serialize/src/index.js # packages/server/src/create-instance/construct-style-tags-from-chunks.js # packages/server/src/create-instance/extract-critical-to-chunks.js # packages/server/src/create-instance/index.js # packages/server/src/create-instance/inline.js # packages/server/src/create-instance/stream.js # packages/styled/src/base.js # packages/weak-memoize/src/index.js # test/testSetup.js
2 parents 1d6cde5 + 23f43ab commit 73073f3

File tree

89 files changed

+747
-944
lines changed

Some content is hidden

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

89 files changed

+747
-944
lines changed

Diff for: .github/workflows/main.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
test:
11-
name: "Tests on ${{matrix.platform}}"
11+
name: 'Tests on ${{matrix.platform}}'
1212
strategy:
1313
fail-fast: false
1414
matrix:
@@ -163,5 +163,3 @@ jobs:
163163
run: yarn lint:check
164164
- name: TypeScript
165165
run: cd packages/${{ matrix.package }} && yarn test:typescript
166-
167-

Diff for: .prettierrc.yaml

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
arrowParens: avoid
12
semi: false
23
singleQuote: true
4+
trailingComma: none
35
overrides:
4-
- files: "docs/*.md"
5-
options:
6-
printWidth: 60
6+
- files: 'docs/*.md'
7+
options:
8+
printWidth: 60

Diff for: CODE_OF_CONDUCT.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ orientation.
1414
Examples of behavior that contributes to creating a positive environment
1515
include:
1616

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
2222

2323
Examples of unacceptable behavior by participants include:
2424

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
3030
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
31+
- Other conduct which could reasonably be considered inappropriate in a
3232
professional setting
3333

3434
## Our Responsibilities
@@ -71,4 +71,4 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage], versi
7171
available at [http://contributor-covenant.org/version/1/4][version]
7272

7373
[homepage]: http://contributor-covenant.org
74-
[version]: http://contributor-covenant.org/version/1/4/
74+
[version]: http://contributor-covenant.org/version/1/4/

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ Look here 👉 _[emotion babel plugin feature table and documentation](https://g
109109
- [Domain.com.au](https://www.domain.com.au)
110110
- [cyberhaven.com](https://cyberhaven.com)
111111
- [CommercialRealEstate.com.au](https://www.commercialrealestate.com.au)
112+
- [codecademy.com](https://www.codecademy.com)
112113

113114
## Contributors
114115

Diff for: codecov.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
comment: # https://docs.codecov.io/docs/pull-request-comments
2-
layout: "files"
2+
layout: 'files'
33
behavior: once
4-
require_changes: true # if true: only post the comment if coverage changes
5-
require_base: no # [yes :: must have a base report to post]
6-
require_head: yes # [yes :: must have a head report to post]
4+
require_changes: true # if true: only post the comment if coverage changes
5+
require_base: no # [yes :: must have a base report to post]
6+
require_head: yes # [yes :: must have a head report to post]
77
branches: null

Diff for: package.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@
5151
"extends": [
5252
"standard",
5353
"standard-react",
54-
"prettier",
55-
"prettier/react"
54+
"prettier"
5655
],
5756
"plugins": [
5857
"prettier",
@@ -211,13 +210,13 @@
211210
"enzyme-adapter-react-16": "^1.15.5",
212211
"enzyme-to-json": "^3.6.1",
213212
"eslint": "^7.10.0",
214-
"eslint-config-prettier": "^6.12.0",
213+
"eslint-config-prettier": "^8.3.0",
215214
"eslint-config-react": "^1.1.7",
216215
"eslint-config-standard": "^14.1.1",
217216
"eslint-config-standard-react": "^9.2.0",
218217
"eslint-plugin-import": "^2.22.1",
219218
"eslint-plugin-node": "^11.1.0",
220-
"eslint-plugin-prettier": "^3.1.4",
219+
"eslint-plugin-prettier": "^3.4.0",
221220
"eslint-plugin-promise": "^4.2.1",
222221
"eslint-plugin-react": "^7.21.3",
223222
"eslint-plugin-react-hooks": "^4.1.2",
@@ -238,7 +237,7 @@
238237
"npm-run-all": "^4.0.2",
239238
"opencollective": "^1.0.3",
240239
"polished": "^1.2.1",
241-
"prettier": "1.14.3",
240+
"prettier": "^2.3.0",
242241
"puppeteer": "^1.6.0",
243242
"raf": "^3.4.0",
244243
"react": "16.14.0",

Diff for: packages/babel-plugin-jsx-pragmatic/src/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default function jsxPragmatic(babel) {
3434

3535
return {
3636
inherits: syntaxJsx,
37-
pre: function() {
37+
pre: function () {
3838
if (!(this.opts.module && this.opts.import)) {
3939
throw new Error(
4040
'@emotion/babel-plugin-jsx-pragmatic: You must specify `module` and `import`'
@@ -43,16 +43,16 @@ export default function jsxPragmatic(babel) {
4343
},
4444
visitor: {
4545
Program: {
46-
exit: function(path, state) {
46+
exit: function (path, state) {
4747
if (!state.get('jsxDetected')) return
4848
addPragmaImport(path, state)
4949
}
5050
},
5151

52-
JSXElement: function(path, state) {
52+
JSXElement: function (path, state) {
5353
state.set('jsxDetected', true)
5454
},
55-
JSXFragment: function(path, state) {
55+
JSXFragment: function (path, state) {
5656
state.set('jsxDetected', true)
5757
}
5858
}

Diff for: packages/babel-plugin/__tests__/__snapshots__/css.js.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ const thing = () => _ref;"
393393
exports[`emotion-babel-plugin css label-function-expression 1`] = `
394394
"import { css } from '@emotion/react'
395395
396-
const thing = function() {
396+
const thing = function () {
397397
return css\`
398398
color: hotpink;
399399
\`
@@ -412,7 +412,7 @@ var _ref = process.env.NODE_ENV === \\"production\\" ? {
412412
} : {
413413
name: \\"1hi0qos-thing\\",
414414
styles: \\"color:hotpink;label:thing;\\",
415-
map: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxhYmVsLWZ1bmN0aW9uLWV4cHJlc3Npb24uanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR1kiLCJmaWxlIjoibGFiZWwtZnVuY3Rpb24tZXhwcmVzc2lvbi5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0J1xuXG5jb25zdCB0aGluZyA9IGZ1bmN0aW9uKCkge1xuICByZXR1cm4gY3NzYFxuICAgIGNvbG9yOiBob3RwaW5rO1xuICBgXG59XG4iXX0= */\\",
415+
map: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxhYmVsLWZ1bmN0aW9uLWV4cHJlc3Npb24uanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR1kiLCJmaWxlIjoibGFiZWwtZnVuY3Rpb24tZXhwcmVzc2lvbi5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0J1xuXG5jb25zdCB0aGluZyA9IGZ1bmN0aW9uICgpIHtcbiAgcmV0dXJuIGNzc2BcbiAgICBjb2xvcjogaG90cGluaztcbiAgYFxufVxuIl19 */\\",
416416
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
417417
};
418418

Diff for: packages/babel-plugin/__tests__/css-macro/__fixtures__/label-function-expression.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { css } from '@emotion/react/macro'
22

3-
const thing = function() {
3+
const thing = function () {
44
return css`
55
color: hotpink;
66
`

Diff for: packages/babel-plugin/__tests__/css-macro/__snapshots__/index.js.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ const thing = () => _ref;"
393393
exports[`@emotion/react - css macro label-function-expression 1`] = `
394394
"import { css } from '@emotion/react/macro'
395395
396-
const thing = function() {
396+
const thing = function () {
397397
return css\`
398398
color: hotpink;
399399
\`
@@ -412,7 +412,7 @@ var _ref = process.env.NODE_ENV === \\"production\\" ? {
412412
} : {
413413
name: \\"1hi0qos-thing\\",
414414
styles: \\"color:hotpink;label:thing;\\",
415-
map: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxhYmVsLWZ1bmN0aW9uLWV4cHJlc3Npb24uanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR1kiLCJmaWxlIjoibGFiZWwtZnVuY3Rpb24tZXhwcmVzc2lvbi5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0L21hY3JvJ1xuXG5jb25zdCB0aGluZyA9IGZ1bmN0aW9uKCkge1xuICByZXR1cm4gY3NzYFxuICAgIGNvbG9yOiBob3RwaW5rO1xuICBgXG59XG4iXX0= */\\",
415+
map: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxhYmVsLWZ1bmN0aW9uLWV4cHJlc3Npb24uanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR1kiLCJmaWxlIjoibGFiZWwtZnVuY3Rpb24tZXhwcmVzc2lvbi5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0L21hY3JvJ1xuXG5jb25zdCB0aGluZyA9IGZ1bmN0aW9uICgpIHtcbiAgcmV0dXJuIGNzc2BcbiAgICBjb2xvcjogaG90cGluaztcbiAgYFxufVxuIl19 */\\",
416416
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
417417
};
418418

Diff for: packages/babel-plugin/src/emotion-macro.js

+21-19
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,31 @@ const isAlreadyTranspiled = path => {
2828
return ['name', 'styles'].every(p => properties.has(p))
2929
}
3030

31-
let createEmotionTransformer = (isPure /*: boolean */) => (
32-
{ state, babel, importSource, reference, importSpecifierName } /*: Object */
33-
) => {
34-
const path = reference.parentPath
31+
let createEmotionTransformer =
32+
(isPure /*: boolean */) =>
33+
(
34+
{ state, babel, importSource, reference, importSpecifierName } /*: Object */
35+
) => {
36+
const path = reference.parentPath
3537

36-
if (isAlreadyTranspiled(path)) {
37-
return
38-
}
38+
if (isAlreadyTranspiled(path)) {
39+
return
40+
}
3941

40-
if (isPure) {
41-
path.addComment('leading', '#__PURE__')
42-
}
42+
if (isPure) {
43+
path.addComment('leading', '#__PURE__')
44+
}
4345

44-
let node = transformExpressionWithStyles({
45-
babel,
46-
state,
47-
path,
48-
shouldLabel: true
49-
})
50-
if (node) {
51-
path.node.arguments[0] = node
46+
let node = transformExpressionWithStyles({
47+
babel,
48+
state,
49+
path,
50+
shouldLabel: true
51+
})
52+
if (node) {
53+
path.node.arguments[0] = node
54+
}
5255
}
53-
}
5456

5557
export let transformers = {
5658
css: createEmotionTransformer(true),

Diff for: packages/babel-plugin/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export type EmotionBabelPluginPass = any
7676

7777
const AUTO_LABEL_VALUES = ['dev-only', 'never', 'always']
7878

79-
export default function(babel, options) {
79+
export default function (babel, options) {
8080
if (
8181
options.autoLabel !== undefined &&
8282
!AUTO_LABEL_VALUES.includes(options.autoLabel)

Diff for: packages/babel-plugin/src/utils/index.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ export { getLabelFromPath } from './label'
22
export { getSourceMap } from './source-maps'
33
export { getTargetClassName } from './get-target-class-name'
44
export { simplifyObject } from './object-to-string'
5-
export {
6-
transformExpressionWithStyles
7-
} from './transform-expression-with-styles'
5+
export { transformExpressionWithStyles } from './transform-expression-with-styles'
86
export { getStyledOptions } from './get-styled-options'
97
export {
108
appendStringReturningExpressionToArguments,

Diff for: packages/babel-preset-css-prop/README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ var _ref =
120120
: {
121121
name: '1fpk7dx-Link',
122122
styles: 'color:hotpink;&:hover{color:darkorchid;}label:Link;',
123-
map:
124-
'/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImF1dG9tYXRpYy1pbXBvcnQuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUkiLCJmaWxlIjoiYXV0b21hdGljLWltcG9ydC5qcyIsInNvdXJjZXNDb250ZW50IjpbImNvbnN0IExpbmsgPSBwcm9wcyA9PiAoXG4gIDxhXG4gICAgY3NzPXt7XG4gICAgICBjb2xvcjogJ2hvdHBpbmsnLFxuICAgICAgJyY6aG92ZXInOiB7XG4gICAgICAgIGNvbG9yOiAnZGFya29yY2hpZCdcbiAgICAgIH1cbiAgICB9fVxuICAgIHsuLi5wcm9wc31cbiAgLz5cbilcbiJdfQ== */'
123+
map: '/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImF1dG9tYXRpYy1pbXBvcnQuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUkiLCJmaWxlIjoiYXV0b21hdGljLWltcG9ydC5qcyIsInNvdXJjZXNDb250ZW50IjpbImNvbnN0IExpbmsgPSBwcm9wcyA9PiAoXG4gIDxhXG4gICAgY3NzPXt7XG4gICAgICBjb2xvcjogJ2hvdHBpbmsnLFxuICAgICAgJyY6aG92ZXInOiB7XG4gICAgICAgIGNvbG9yOiAnZGFya29yY2hpZCdcbiAgICAgIH1cbiAgICB9fVxuICAgIHsuLi5wcm9wc31cbiAgLz5cbilcbiJdfQ== */'
125124
}
126125

127126
const Link = props =>

Diff for: packages/cache/types/tsconfig.json

+3-11
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
"baseUrl": "../",
44
"forceConsistentCasingInFileNames": true,
55
"jsx": "react",
6-
"lib": [
7-
"es6",
8-
"dom"
9-
],
6+
"lib": ["es6", "dom"],
107
"module": "commonjs",
118
"noEmit": true,
129
"noImplicitAny": true,
@@ -15,13 +12,8 @@
1512
"strictNullChecks": true,
1613
"strictFunctionTypes": true,
1714
"target": "es5",
18-
"typeRoots": [
19-
"../"
20-
],
15+
"typeRoots": ["../"],
2116
"types": []
2217
},
23-
"include": [
24-
"./*.ts",
25-
"./*.tsx"
26-
]
18+
"include": ["./*.ts", "./*.tsx"]
2719
}

Diff for: packages/cache/types/tslint.json

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
{
2-
"extends": "dtslint/dtslint.json",
3-
"rules": {
4-
"array-type": [
5-
true,
6-
"generic"
7-
],
8-
"semicolon": false
9-
}
2+
"extends": "dtslint/dtslint.json",
3+
"rules": {
4+
"array-type": [true, "generic"],
5+
"semicolon": false
6+
}
107
}

Diff for: packages/css-prettifier/src/index.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ const prettyStringify = memoize(
2828
case 'rule':
2929
element.value = element.props.join(
3030
element.root &&
31-
(element.root.type === '@keyframes' ||
32-
element.root.type === '@-webkit-keyframes')
31+
(element.root.type === '@keyframes' ||
32+
element.root.type === '@-webkit-keyframes')
3333
? ', '
3434
: ',\n'
3535
)
@@ -39,10 +39,7 @@ const prettyStringify = memoize(
3939
? (element.return =
4040
element.value +
4141
' {\n' +
42-
children
43-
.trim()
44-
.replace(/^/gm, indentation)
45-
.replace(/^\s+$/gm, '') +
42+
children.trim().replace(/^/gm, indentation).replace(/^\s+$/gm, '') +
4643
'\n}\n\n')
4744
: ''
4845
}

Diff for: packages/css/src/create-instance.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export type Emotion = {
7171
let createEmotion = (options) /*: Emotion */ => {
7272
let cache = createCache(options)
7373

74-
cache.sheet.speedy = function(value /*: boolean */) {
74+
cache.sheet.speedy = function (value /*: boolean */) {
7575
if (process.env.NODE_ENV !== 'production' && this.ctr !== 0) {
7676
throw new Error('speedy must be changed before any rules are inserted')
7777
}

Diff for: packages/css/test/no-babel/index.test.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ describe('css', () => {
160160
})
161161
test('glamorous style api & composition', () => {
162162
const H1 = styled('h1')(props => ({ fontSize: props.fontSize }))
163-
const H2 = styled(H1)(props => ({ flex: props.flex }), { display: 'flex' })
163+
const H2 = styled(H1)(props => ({ flex: props.flex }), {
164+
display: 'flex'
165+
})
164166

165167
const tree = renderer
166168
.create(

Diff for: packages/css/types/tsconfig.json

+3-11
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
"baseUrl": "../",
44
"forceConsistentCasingInFileNames": true,
55
"jsx": "react",
6-
"lib": [
7-
"es6",
8-
"dom"
9-
],
6+
"lib": ["es6", "dom"],
107
"module": "commonjs",
118
"noEmit": true,
129
"noImplicitAny": true,
@@ -15,13 +12,8 @@
1512
"strictNullChecks": true,
1613
"strictFunctionTypes": true,
1714
"target": "es5",
18-
"typeRoots": [
19-
"../"
20-
],
15+
"typeRoots": ["../"],
2116
"types": []
2217
},
23-
"include": [
24-
"./*.ts",
25-
"./*.tsx"
26-
]
18+
"include": ["./*.ts", "./*.tsx"]
2719
}

0 commit comments

Comments
 (0)