Skip to content

Commit b99260b

Browse files
add prettier
1 parent 0864165 commit b99260b

Some content is hidden

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

68 files changed

+1271
-607
lines changed

.eslintrc

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
11
{
2-
"extends": "eslint:recommended",
2+
"extends": [
3+
"eslint:recommended",
4+
"prettier"
5+
],
36
"parser": "babel-eslint",
47
"env": {
5-
"jest": true,
68
"browser": true,
79
"node": true,
810
"es6": true
911
},
10-
"globals": {
11-
"Promise": true,
12-
"jasmine": true
13-
},
1412
"plugins": [
15-
"react"
13+
"babel",
14+
"react",
15+
"prettier"
1616
],
1717
"settings": {
1818
"react": {
19-
"pragma": "h"
19+
"pragma": "h",
20+
"version": "preact"
21+
}
22+
},
23+
"parserOptions": {
24+
"ecmaVersion": 2018,
25+
"ecmaFeatures": {
26+
"jsx": true
2027
}
2128
},
2229
"rules": {

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
**Did you add tests for your changes?**
88

9-
109
**Summary**
1110

1211
<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->

.github/issue_template.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- Please don't delete this template -->
22
<!-- Before creating an issue please make sure you are using the latest version of preact-cli. -->
33

4-
**Do you want to request a *feature* or report a *bug*?**
4+
**Do you want to request a _feature_ or report a _bug_?**
55

66
**What is the current behaviour?**
77

@@ -14,6 +14,7 @@
1414
**If this is a feature request, what is motivation or use case for changing the behaviour?**
1515

1616
**Please mention other relevant information.**
17+
1718
- Node version
1819
- npm version
1920
- Operating system

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/node_modules
2+
**/tests/output
3+
**/package.json

.prettierrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"trailingComma": "es5",
3+
"tabWidth": 2,
4+
"semi": true,
5+
"useTabs": true,
6+
"singleQuote": true,
7+
"endOfLine": "lf"
8+
}

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ cache:
2424
- node_modules
2525

2626
before_script:
27-
- export WITH_LOG=true
28-
- export LIGHTHOUSE_CHROMIUM_PATH=`which google-chrome-stable`
27+
- export WITH_LOG=true
28+
- export LIGHTHOUSE_CHROMIUM_PATH=`which google-chrome-stable`
2929

3030
script:
31-
- npm run test -- --verbose
31+
- npm run test -- --verbose

CODE_OF_CONDUCT.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo
88

99
Examples of behavior that contributes to creating a positive environment include:
1010

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

1717
Examples of unacceptable behavior by participants include:
1818

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

2525
## Our Responsibilities
2626

README.md

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ $ preact create <template-name> <project-name>
3333
```
3434

3535
Example:
36+
3637
```sh
3738
$ preact create default my-project
3839
```
@@ -156,6 +157,7 @@ npm run serve -- --server config
156157
Preact CLI in order to follow [PRPL] pattern renders initial route (`/`) into generated static `index.html` - this ensures that users get to see your page before any JavaScript is run, and thus providing users with slow devices or poor connection your website's content much faster.
157158

158159
Preact CLI does this by rendering your app inside node - this means that we don't have access to DOM or other global variables available in browsers, similar how it would be in server-side rendering scenarios. In case you need to rely on browser APIs you could:
160+
159161
- drop out of prerendering by passing `--no-prerender` flag to `preact build`,
160162
- write your code in a way that supports server-side rendering by wrapping code that requires browser's APIs in conditional statements `if (typeof window !== "undefined") { ... }` ensuring that on server those lines of code are never reached. Alternatively you could use a helper library like [window-or-global](https://www.npmjs.com/package/window-or-global).
161163

@@ -192,7 +194,7 @@ To customize Babel, you have two options:
192194

193195
#### Webpack
194196

195-
To customize webpack create ```preact.config.js``` file which exports function that will change webpack's config.
197+
To customize webpack create `preact.config.js` file which exports function that will change webpack's config.
196198

197199
```js
198200
/**
@@ -203,12 +205,12 @@ To customize webpack create ```preact.config.js``` file which exports function t
203205
* @param {object} env - options passed to CLI.
204206
* @param {WebpackConfigHelpers} helpers - object with useful helpers when working with config.
205207
**/
206-
export default function (config, env, helpers) {
207-
/** you can change config here **/
208+
export default function(config, env, helpers) {
209+
/** you can change config here **/
208210
}
209211
```
210212

211-
See [WebpackConfigHelpers] docs for more info on ```helpers``` argument which contains methods to find various parts of configuration. Additionally see our [recipes wiki] containing examples on how to change webpack configuration.
213+
See [WebpackConfigHelpers] docs for more info on `helpers` argument which contains methods to find various parts of configuration. Additionally see our [recipes wiki] containing examples on how to change webpack configuration.
212214

213215
#### Prerender multiple routes
214216

@@ -218,12 +220,15 @@ The format required for defining your routes is an array of objects with a `url`
218220

219221
```js
220222
// prerender-urls.json
221-
[{
222-
"url": "/",
223-
"title": "Homepage"
224-
}, {
225-
"url": "/route/random"
226-
}]
223+
[
224+
{
225+
url: '/',
226+
title: 'Homepage',
227+
},
228+
{
229+
url: '/route/random',
230+
},
231+
];
227232
```
228233

229234
You can customise the path of `prerender-urls.json` by using the flag `--prerenderUrls`.
@@ -247,10 +252,10 @@ preact build --template src/template.html
247252
preact watch --template src/template.html
248253
```
249254

250-
[Promise]: https://npm.im/promise-polyfill
255+
[promise]: https://npm.im/promise-polyfill
251256
[fetch]: https://github.com/developit/unfetch
252257
[preact]: https://github.com/developit/preact
253-
[WebpackConfigHelpers]: docs/webpack-helpers.md
258+
[webpackconfighelpers]: docs/webpack-helpers.md
254259
[`.babelrc`]: https://babeljs.io/docs/usage/babelrc
255260
[simple]: https://github.com/preactjs-templates/simple
256261
[`"browserslist"`]: https://github.com/ai/browserslist
@@ -260,14 +265,14 @@ preact watch --template src/template.html
260265
[preact-router]: https://github.com/developit/preact-router
261266
[material]: https://github.com/preactjs-templates/material
262267
[widget]: https://github.com/preactjs-templates/widget
263-
[Plugins wiki]: https://github.com/developit/preact-cli/wiki/Plugins
268+
[plugins wiki]: https://github.com/developit/preact-cli/wiki/Plugins
264269
[preactjs-templates organization]: https://github.com/preactjs-templates
265270
[preactjs-templates/default]: https://github.com/preactjs-templates/default
266271
[recipes wiki]: https://github.com/developit/preact-cli/wiki/Config-Recipes
267-
[PRPL]: https://developers.google.com/web/fundamentals/performance/prpl-pattern
272+
[prpl]: https://developers.google.com/web/fundamentals/performance/prpl-pattern
268273
[`babel-preset-env`]: https://github.com/babel/babel-preset-env#targetsbrowsers
269274
[proof]: https://googlechrome.github.io/lighthouse/viewer/?gist=142af6838482417af741d966e7804346
270-
[Preact CLI preset]: https://github.com/developit/preact-cli/blob/master/src/lib/babel-config.js
271-
[Service Workers]: https://developers.google.com/web/fundamentals/getting-started/primers/service-workers
272-
[Customize Babel]: https://github.com/developit/preact-cli/wiki/Config-Recipes#customising-babel-options-using-loader-helpers
275+
[preact cli preset]: https://github.com/developit/preact-cli/blob/master/src/lib/babel-config.js
276+
[service workers]: https://developers.google.com/web/fundamentals/getting-started/primers/service-workers
277+
[customize babel]: https://github.com/developit/preact-cli/wiki/Config-Recipes#customising-babel-options-using-loader-helpers
273278
[`async!`]: https://github.com/developit/preact-cli/blob/222e7018dd360e40f7db622191aeca62d6ef0c9a/examples/full/src/components/app.js#L7

0 commit comments

Comments
 (0)