Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump Prettier and Prettier accessories to 2.x #2387

Merged
merged 3 commits into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
test:
name: "Tests on ${{matrix.platform}}"
name: 'Tests on ${{matrix.platform}}'
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -194,5 +194,3 @@ jobs:
run: yarn lint:check
- name: TypeScript
run: cd packages/${{ matrix.package }} && yarn test:typescript


14 changes: 8 additions & 6 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
arrowParens: avoid
semi: false
singleQuote: true
trailingComma: none
Comment on lines +1 to +4
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I agree with the Prettier defaults here, but for the sake of touching fewer files added the overrides to preserve this repo's old behavior. Thoughts?

Suggested change
arrowParens: avoid
semi: false
singleQuote: true
trailingComma: none
semi: false
singleQuote: true

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ye, keeping the output as close to what we have in the repo currently is preferable (although I also agree that we could switch defaults of those 2 later on)

overrides:
- files: "docs/*.md"
options:
printWidth: 60
- files: "*.js"
options:
parser: flow
- files: 'docs/*.md'
options:
printWidth: 60
- files: '*.js'
options:
parser: flow
24 changes: 12 additions & 12 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ orientation.
Examples of behavior that contributes to creating a positive environment
include:

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

Examples of unacceptable behavior by participants include:

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

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

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
[version]: http://contributor-covenant.org/version/1/4/
8 changes: 4 additions & 4 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
comment: # https://docs.codecov.io/docs/pull-request-comments
layout: "files"
layout: 'files'
behavior: once
require_changes: true # if true: only post the comment if coverage changes
require_base: no # [yes :: must have a base report to post]
require_head: yes # [yes :: must have a head report to post]
require_changes: true # if true: only post the comment if coverage changes
require_base: no # [yes :: must have a base report to post]
require_head: yes # [yes :: must have a head report to post]
branches: null
2 changes: 1 addition & 1 deletion docs/cache-provider.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const myCache = createCache({
customPlugin,
// has to be included manually when customizing `stylisPlugins` if you want to have vendor prefixes added automatically
prefixer
],
]
})

render(
Expand Down
4 changes: 2 additions & 2 deletions docs/composition.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ render(
<div>
<div css={base}>This will be turquoise</div>
<div css={[danger, base]}>
This will be also be turquoise since the base styles
overwrite the danger styles.
This will be also be turquoise since the base styles overwrite the danger
styles.
</div>
<div css={[base, danger]}>This will be red</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions docs/emotion-11.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Most of this renaming can be done automatically via a codemod, following these s
1. Run `eslint` with the `--fix` flag. For example: `yarn eslint --config .eslintrc --ext .js,.jsx "." --fix`

The full list of renamed packages:

- `@emotion/core` → `@emotion/react`
- `emotion` → `@emotion/css`
- `emotion-theming` → moved into ` @emotion/react`
Expand Down
29 changes: 18 additions & 11 deletions docs/flow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,20 @@ alternatives:
import styled from '@emotion/styled'

// Option A
const A = styled<Props>('div')`
const A =
JoshuaKGoldberg marked this conversation as resolved.
Show resolved Hide resolved
styled <
Props >
'div'`
color: red;
`

// Option B
const B = styled.div<Props>({
color: 'red',
})
const B =
styled.div <
Props >
{
color: 'red'
}
```

Styled components are annotated the same way normal React components are:
Expand All @@ -34,7 +40,10 @@ Styled components are annotated the same way normal React components are:
import styled from '@emotion/styled'

type Props = { a: string }
const Link = styled<Props>('a')`
const Link =
styled <
Props >
'a'`
color: red;
`

Expand All @@ -56,7 +65,6 @@ Be aware, Flow infers the return type of your components by referencing their re
this means you will need to annotate the properties of the root component in the case below:

```jsx

const Container = styled.div`
^^^^^^^^^^^ Missing type annotation for P. P is a type parameter declared in function type [1] and was implicitly instantiated at
encaps tag [2].
Expand All @@ -73,14 +81,16 @@ any existing React component:
import type { ElementConfig } from 'react'

type Props = ElementConfig<'div'>
const Container = styled<Props>('div')`
const Container =
styled <
Props >
'div'`
color: red;
`

export const App = () => <Container />
```


```jsx
import type { ElementConfig } from 'react'
import styled from '@emotion/styled'
Expand Down Expand Up @@ -110,6 +120,3 @@ const Container = styled.div`

export const App = (): Node => <Container />
```



1 change: 1 addition & 0 deletions docs/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The ["@emotion/react"](https://www.npmjs.com/package/@emotion/react) package req
- Best when using React with a build environment that can be configured.

- `css` prop support

- Similar to the `style` prop, but also has support for auto vendor-prefixing, nested selectors, and media queries.

- Allows developers to skip the `styled` API abstraction and style components and elements directly.
Expand Down
8 changes: 2 additions & 6 deletions docs/media-queries.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ import { jsx, css } from '@emotion/react'

const breakpoints = [576, 768, 992, 1200]

const mq = breakpoints.map(
bp => `@media (min-width: ${bp}px)`
)
const mq = breakpoints.map(bp => `@media (min-width: ${bp}px)`)

render(
<div>
Expand Down Expand Up @@ -92,9 +90,7 @@ import facepaint from 'facepaint'

const breakpoints = [576, 768, 992, 1200]

const mq = facepaint(
breakpoints.map(bp => `@media (min-width: ${bp}px)`)
)
const mq = facepaint(breakpoints.map(bp => `@media (min-width: ${bp}px)`))

render(
<div
Expand Down
8 changes: 2 additions & 6 deletions docs/migrating-to-emotion-10.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ let important = css`
`

const SomeComponent = props => (
<div
className={cx(basic, props.important && important)}
/>
<div className={cx(basic, props.important && important)} />
)
```

Expand Down Expand Up @@ -206,7 +204,6 @@ let element = (

- Replace `injectGlobal` with `Global` styles


```jsx
import { injectGlobal } from 'emotion'

Expand All @@ -219,8 +216,7 @@ injectGlobal`
// ↓ ↓ ↓ ↓ ↓ ↓

import { Global, css } from '@emotion/core'

<Global
;<Global
styles={css`
* {
box-sizing: border-box;
Expand Down
8 changes: 2 additions & 6 deletions docs/nested.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,9 @@ const paragraph = css`
render(
<div>
<header>
<p css={paragraph}>
This is green since it's inside a header
</p>
<p css={paragraph}>This is green since it's inside a header</p>
</header>
<p css={paragraph}>
This is turquoise since it's not inside a header.
</p>
<p css={paragraph}>This is turquoise since it's not inside a header.</p>
</div>
)
```
31 changes: 9 additions & 22 deletions docs/object-styles.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ const Button = styled.button(
})
)

render(
<Button fontSize={16}>
This is a darkorchid button.
</Button>
)
render(<Button fontSize={16}>This is a darkorchid button.</Button>)
```

### Child Selectors
Expand Down Expand Up @@ -85,8 +81,7 @@ render(
}
}}
>
This is orange on a big screen and darkorchid on a small
screen.
This is orange on a big screen and darkorchid on a small screen.
</div>
)
```
Expand Down Expand Up @@ -129,8 +124,7 @@ render(
{ padding: 8 }
]}
>
This is darkorchid with a hotpink background and 8px of
padding.
This is darkorchid with a hotpink background and 8px of padding.
</div>
)
```
Expand All @@ -147,16 +141,12 @@ import { jsx } from '@emotion/react'
render(
<div
css={{
background: [
'red',
'linear-gradient(#e66465, #9198e5)'
],
background: ['red', 'linear-gradient(#e66465, #9198e5)'],
height: 100
}}
>
This has a gradient background in browsers that support
gradients and is red in browsers that don't support
gradients
This has a gradient background in browsers that support gradients and is red
in browsers that don't support gradients
</div>
)
```
Expand Down Expand Up @@ -209,13 +199,10 @@ const hotpinkWithBlackBackground = css(
render(
<div>
<p css={hotpink}>This is hotpink</p>
<button css={hotpinkHoverOrFocus}>
This is hotpink on hover or focus
</button>
<button css={hotpinkHoverOrFocus}>This is hotpink on hover or focus</button>
<p css={hotpinkWithBlackBackground}>
This has a black background and is hotpink. Try moving
where hotpink is in the css call and see if the color
changes.
This has a black background and is hotpink. Try moving where hotpink is in
the css call and see if the color changes.
</p>
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion docs/package-summary.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Package Summaries"
title: 'Package Summaries'
---

Below is a list of most of Emotion's packages and a summary of what it's for and how it relates to other Emotion packages.
Expand Down
Loading