Skip to content

Commit d963b85

Browse files
committed
Run prettier over new files
1 parent a869d92 commit d963b85

File tree

8 files changed

+42
-48
lines changed

8 files changed

+42
-48
lines changed

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"singleQuotes": true
2+
"singleQuote": true
33
}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ class ThemeToggler extends React.Component<
4545
this.setState(state => ({
4646
theme: state.theme === 'light' ? 'dark' : 'light'
4747
}));
48-
}}>
48+
}}
49+
>
4950
Toggle theme
5051
</button>
5152
{this.props.children}

examples/theme-example/index.html

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
<!doctype html>
12
<html>
2-
<body>
3-
<style>
4-
body {
5-
background-color: pink
6-
}
7-
</style>
8-
<div id='container'></div>
9-
<script type='text/javascript' src='./bundle.js'></script>
10-
</body>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Home</title>
6+
<style>
7+
body {
8+
background-color: pink;
9+
}
10+
</style>
11+
</head>
12+
<body>
13+
<div id='container'></div>
14+
<script type='text/javascript' src='./bundle.js'></script>
15+
</body>
1116
</html>

examples/theme-example/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@flow
2-
import React from "react";
3-
import { render } from "react-dom";
4-
import { ThemeToggler, Title, Emoji } from "./theme-context";
2+
import React from 'react';
3+
import { render } from 'react-dom';
4+
import { ThemeToggler, Title, Emoji } from './theme-context';
55

66
const App = () => (
77
<ThemeToggler>
@@ -10,4 +10,4 @@ const App = () => (
1010
</ThemeToggler>
1111
);
1212

13-
render(<App />, document.getElementById("container"));
13+
render(<App />, document.getElementById('container'));

examples/theme-example/theme-context.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// @flow
2-
import React from "react";
3-
import createReactContext from "../../src";
2+
import React from 'react';
3+
import createReactContext from '../../src';
44

5-
type Theme = "light" | "dark";
5+
type Theme = 'light' | 'dark';
66
// Pass a default theme to ensure type correctness
7-
const ThemeContext: Context<Theme> = createReactContext("light");
7+
const ThemeContext: Context<Theme> = createReactContext('light');
88

99
export class ThemeToggler extends React.Component<
1010
{ children: Node },
1111
{ theme: Theme }
1212
> {
13-
state = { theme: "light" };
13+
state = { theme: 'light' };
1414
render() {
1515
return (
1616
// Pass the current context value to the Provider's `value` prop.
@@ -19,7 +19,7 @@ export class ThemeToggler extends React.Component<
1919
<button
2020
onClick={() => {
2121
this.setState(state => ({
22-
theme: state.theme === "light" ? "dark" : "light"
22+
theme: state.theme === 'light' ? 'dark' : 'light'
2323
}));
2424
}}
2525
>
@@ -38,7 +38,7 @@ export class Title extends React.Component<{ children: Node }> {
3838
// props namespace.
3939
<ThemeContext.Consumer>
4040
{theme => (
41-
<h1 style={{ color: theme === "light" ? "#000" : "#fff" }}>
41+
<h1 style={{ color: theme === 'light' ? '#000' : '#fff' }}>
4242
{this.props.children}
4343
</h1>
4444
)}
@@ -54,13 +54,13 @@ export class Emoji extends React.Component<{ children: Node }> {
5454
{theme => (
5555
<div
5656
style={{
57-
fontSize: "35px",
58-
background: "white",
59-
height: "40px",
60-
width: "40px"
57+
fontSize: '35px',
58+
background: 'white',
59+
height: '40px',
60+
width: '40px'
6161
}}
6262
>
63-
{theme === "light" ? "⚡️" : "🕶"}
63+
{theme === 'light' ? '⚡️' : '🕶'}
6464
</div>
6565
)}
6666
</ThemeContext.Consumer>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module.exports = {
2-
entry: "./index.js",
2+
entry: './index.js',
33
output: {
4-
filename: "bundle.js"
4+
filename: 'bundle.js'
55
},
66
module: {
7-
rules: [{ test: /\.js$/, use: "babel-loader" }]
7+
rules: [{ test: /\.js$/, use: 'babel-loader' }]
88
}
99
};

package.json

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,8 @@
66
"repository": "https://github.com/thejameskyle/create-react-context",
77
"author": "James Kyle <me@thejameskyle.com>",
88
"license": "MIT",
9-
"keywords": [
10-
"react",
11-
"context",
12-
"contextTypes",
13-
"polyfill",
14-
"ponyfill"
15-
],
16-
"files": [
17-
"lib"
18-
],
9+
"keywords": ["react", "context", "contextTypes", "polyfill", "ponyfill"],
10+
"files": ["lib"],
1911
"scripts": {
2012
"test": "jest",
2113
"flow": "flow",
@@ -49,15 +41,10 @@
4941
"react-dom": "^16.2.0"
5042
},
5143
"lint-staged": {
52-
"*.{js,md,json,js.flow,d.ts}": [
53-
"prettier --write",
54-
"git add"
55-
]
44+
"*.{js,md,json,js.flow,d.ts}": ["prettier --write", "git add"]
5645
},
5746
"jest": {
58-
"snapshotSerializers": [
59-
"enzyme-to-json/serializer"
60-
]
47+
"snapshotSerializers": ["enzyme-to-json/serializer"]
6148
},
6249
"dependencies": {
6350
"mitt": "^1.1.3"

src/__tests__/createReactContext.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ class ThemeToggler extends React.Component<
2626
this.setState(state => ({
2727
theme: state.theme === 'light' ? 'dark' : 'light'
2828
}));
29-
}}>
29+
}}
30+
>
3031
Toggle theme
3132
</button>
3233
{this.props.children}

0 commit comments

Comments
 (0)