Skip to content

Commit

Permalink
Remove trailing spaces (vercel#6547)
Browse files Browse the repository at this point in the history
### changes
#### remove trailing spaces

When I was using example I noticed trailing spaces.
So, this PR removes the trailing spaces of json file, README, and others.

`examples/with-jest-typescript/src/modules/cars/Overview.tsx` also has it, but this time it did not change as tslint error occurs at commit.
  • Loading branch information
thinceller authored and timneutkens committed Mar 7, 2019
1 parent e112df4 commit d9060f5
Show file tree
Hide file tree
Showing 28 changed files with 62 additions and 62 deletions.
2 changes: 1 addition & 1 deletion errors/cant-override-next-props.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ In your `pages/_app.js` you returned an object from `getInitialProps` that conta

#### Possible Ways to Fix It

Look in your _app.js component's `getInitialProps` function and make sure neither of these property names are present in the object returned.
Look in your _app.js component's `getInitialProps` function and make sure neither of these property names are present in the object returned.

### Useful Links

Expand Down
2 changes: 1 addition & 1 deletion errors/circular-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#### Why This Error Occurred

`getInitialProps` is serialized to JSON using `JSON.stringify` and sent to the client side for hydrating the page.
`getInitialProps` is serialized to JSON using `JSON.stringify` and sent to the client side for hydrating the page.

However, the result returned from `getInitialProps` can't be serialized when it has a circular structure.

Expand Down
2 changes: 1 addition & 1 deletion errors/multi-tabs.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ More info here: https://tools.ietf.org/html/rfc6202#section-5.1

#### Possible Ways to Fix It

- Don't have too many tabs open to the same Next.js site open in development in the same browser at the same time.
- Don't have too many tabs open to the same Next.js site open in development in the same browser at the same time.
- If using Firefox you can increase this limit by navigating to `about:config` and setting `network.http.max-persistent-connections-per-server` to a higher number

4 changes: 2 additions & 2 deletions errors/popstate-state-empty.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#### Why This Error Occurred

When using the browser back button the popstate event is triggered. Next.js sets
When using the browser back button the popstate event is triggered. Next.js sets
`popstate` event triggered but `event.state` did not have `url` or `as`, causing a route change failure

#### Possible Ways to Fix It

The only known cause of this issue is manually manipulating `window.history` instead of using `next/router`
The only known cause of this issue is manually manipulating `window.history` instead of using `next/router`

### Useful Links

Expand Down
2 changes: 1 addition & 1 deletion errors/promise-in-next-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The webpack function in `next.config.js` returned a promise which is not support

```js
module.exports = {
webpack: async function(config) {
webpack: async function(config) {
return config
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/custom-server-actionhero/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Running Next.JS and React /inside/ of ActionHero

This server will render dynamic next.js/react pages on some routes, and normal ActionHero API requests on others.
This server will render dynamic next.js/react pages on some routes, and normal ActionHero API requests on others.<br>
This configuration works with both Next and ActionHero hot reloading of code.

A more detailed example showcasing how to use fetch and web sockets to interact with your API can be found here: https://github.com/actionhero/next-in-actionhero
Expand Down Expand Up @@ -100,7 +100,7 @@ module.exports = class CreateChatRoom extends Action {

3. Tell ActionHero to use the api rather than the file server as the top-level route in `api.config.servers.web.rootEndpointType = 'api'`. This will allows "/" to listen to API requests. Also update `api.config.general.paths.public = [ path.join(__dirname, '/../static') ]`. In this configuration, the next 'static' renderer will take priority over the ActionHero 'public file' api. Note that any static assets (CSS, fonts, etc) will need to be in "./static" rather than "./public".

Note that this is where the websocket server, if you enable it, will place the `ActionheroWebsocketClient` libraray.
Note that this is where the websocket server, if you enable it, will place the `ActionheroWebsocketClient` libraray.<br>

4. Configure a wild-card route at the lowest priority of your GET handler to catch all web requests that aren't caught by other actions:

Expand Down
6 changes: 3 additions & 3 deletions examples/custom-server-koa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ The example shows a server that serves the component living in `pages/a.js` when

## Side note: Enabling gzip compression

The most common Koa middleware for handling the gzip compression is [compress](https://github.com/koajs/compress), but unfortunately it is currently not compatible with Next.
`koa-compress` handles the compression of the response body by checking `res.body`, which will be empty in the case of the routes handled by Next (because Next sends and ends the response by itself).
The most common Koa middleware for handling the gzip compression is [compress](https://github.com/koajs/compress), but unfortunately it is currently not compatible with Next.<br>
`koa-compress` handles the compression of the response body by checking `res.body`, which will be empty in the case of the routes handled by Next (because Next sends and ends the response by itself).

If you need to enable the gzip compression, the most simple way to do so is by wrapping the express-middleware [compression](https://github.com/expressjs/compression) with [koa-connect](https://github.com/vkurchatkin/koa-connect):
If you need to enable the gzip compression, the most simple way to do so is by wrapping the express-middleware [compression](https://github.com/expressjs/compression) with [koa-connect](https://github.com/vkurchatkin/koa-connect):

```javascript
const compression = require('compression');
Expand Down
4 changes: 2 additions & 2 deletions examples/root-static-files/static/sitemap.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.example.com/foo.html</loc>
<loc>http://www.example.com/foo.html</loc>
</url>
</urlset>
2 changes: 1 addition & 1 deletion examples/using-with-router/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ now

## The idea behind the example

Sometimes, we want to use the `router` inside component of our app without using the singleton `next/router` API.
Sometimes, we want to use the `router` inside component of our app without using the singleton `next/router` API.

You can do that by creating a React Higher Order Component with the help of the `withRouter` utility.
4 changes: 2 additions & 2 deletions examples/with-algolia-react-instantsearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ now

## The idea behind the example
The goal of this example is to illustrate how you can use [Algolia React InstantSearch](https://community.algolia.com/react-instantsearch/) to perform
your search with a Server-rendered application developed with Next.js. It also illustrates how you
can keep in sync the Url with the search.
your search with a Server-rendered application developed with Next.js. It also illustrates how you
can keep in sync the Url with the search.
12 changes: 6 additions & 6 deletions examples/with-cloud9/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,26 @@ nvm use node
const { createServer } = require('http')
const { parse } = require('url')
const next = require('next')

const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handle = app.getRequestHandler()

app.prepare().then(() => {
let server = createServer((req, res) => {
// Be sure to pass `true` as the second argument to `url.parse`.
// This tells it to parse the query portion of the URL.
const parsedUrl = parse(req.url, true)
const { pathname, query } = parsedUrl

handle(req, res, parsedUrl)
}).listen(process.env.PORT, process.env.IP || "0.0.0.0", err => {
if (err) throw err
let addr = server.address();
console.log("> Ready on http://", addr.address + ":" + addr.port);
})
})

## Change 'package.json' scripts to use that file ##

"scripts": {
Expand All @@ -52,7 +52,7 @@ nvm use node

## Use dev preview within the Cloud9 VM IDE ##

After starting up the server (by using 'Run' button while having server.js open
After starting up the server (by using 'Run' button while having server.js open
in the IDE editor or by using "npm run dev" in terminal) you should be able to access web server by
clicking on "Preview" -> "Preview running application" next to 'Run' button in
the top menu in Cloud9 IDE.
the top menu in Cloud9 IDE.
2 changes: 1 addition & 1 deletion examples/with-context-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ now

## The idea behind the example*

This example shows how to use react context api in our app.
This example shows how to use react context api in our app.

It provides an example of using `pages/_app.js` to include include the context api provider and then shows how both the `pages/index.js` and `pages/about.js` can both share the same data using the context api consumer.

Expand Down
2 changes: 1 addition & 1 deletion examples/with-dotenv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ now

## The idea behind the example

This example shows how to inline env vars.
This example shows how to inline env vars.

**Please note**:

Expand Down
10 changes: 5 additions & 5 deletions examples/with-env-from-next-config-js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ More specifically, what that means, is that environmental variables are programm
returned to your react components (including `getInitialProps`) when the program is built with `next build`.

As the build process (`next build`) is proceeding, `next.config.js` is processed and passed in as a parameter is the variable `phase`.
`phase` can have the values `PHASE_DEVELOPMENT_SERVER` or `PHASE_PRODUCTION_BUILD` (as defined in `next\constants`). Based on the variable
`phase` can have the values `PHASE_DEVELOPMENT_SERVER` or `PHASE_PRODUCTION_BUILD` (as defined in `next\constants`). Based on the variable
`phase`, different environmental variables can be set for use in your react app. That is, if you reference `process.env.RESTURL_SPEAKERS`
in your react app, whatever is returned by `next.config.js` as the variable `env`, (or `env.RESTURL_SPEAKERS`) will be accessible in your
app as `process.env.RESTURL_SPEAKERS`.

> ## Special note
>
>
> `next build` does a hard coded variable substitution into your JavaScript before the final bundle is created. This means
> that if you change your environmental variables outside of your running app, such as in windows with `set` or lunix with `setenv`
> those changes will not be reflected in your running application until a build happens again (with `next build`).
Expand All @@ -63,8 +63,8 @@ This example is not meant to be a reference standard for how to do development,
production builds with Next. This is just one possible scenario that could be used if you want the
following behavior while you are doing development.

* When your run `next dev` or `npm run dev`, you will always use the environmental variables assigned when `isDev` is true in the example.
* When you run `next build` then `next start`, assuming you set externally the environmental variable STAGING to anything but 1, you will get the results assuming `isProd` is true.
* When your run `next dev` or `npm run dev`, you will always use the environmental variables assigned when `isDev` is true in the example.
* When you run `next build` then `next start`, assuming you set externally the environmental variable STAGING to anything but 1, you will get the results assuming `isProd` is true.
* When your run `next build` or `npm run build` in production, if the environmental variable `STAGING` is set to `1`, `isStaging` will be set and you will get those values returned.

You can read more about this feature in thie blog post <a href="https://zeit.co/blog/next5-1" target="_blank">Next.js 5.1: Faster Page Resolution, Environment Config and More</a> (under Environment Config).
You can read more about this feature in thie blog post <a href="https://zeit.co/blog/next5-1" target="_blank">Next.js 5.1: Faster Page Resolution, Environment Config and More</a> (under Environment Config).
2 changes: 1 addition & 1 deletion examples/with-firebase-authentication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ now
```

## The idea behind the example
The goal is to authenticate users with firebase and store their auth token in sessions. A logged in user will see their messages on page load and then be able to post new messages.
The goal is to authenticate users with firebase and store their auth token in sessions. A logged in user will see their messages on page load and then be able to post new messages.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"npm run build-functions",
"npm run build-app",
"npm run copy-deps",
"npm run install-deps"
"npm run install-deps"
]
},
"hosting": {
Expand Down
6 changes: 3 additions & 3 deletions examples/with-mobx-state-tree-typescript/tslint.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": [
"tslint-config-standard",
"tslint:latest",
"tslint:latest",
"tslint-react"
],
"rules": {
Expand All @@ -12,7 +12,7 @@
"no-console": false,
"no-object-literal-type-assertion": false,
"no-submodule-imports": [
true,
true,
"next"
],
"no-unused-variable": false,
Expand Down Expand Up @@ -48,4 +48,4 @@
"check-type-operator"
]
}
}
}
4 changes: 2 additions & 2 deletions examples/with-next-css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
}

/* Post-CSS */
/*
/*
:root {
--some-color: red;
}
.example {
color: var(--some-color);
}
}
*/
2 changes: 1 addition & 1 deletion examples/with-next-less/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ now

## The idea behind the example

This example demonstrates how to use the [next-less plugin](https://github.com/zeit/next-plugins/tree/master/packages/next-less).
This example demonstrates how to use the [next-less plugin](https://github.com/zeit/next-plugins/tree/master/packages/next-less).<br>
It includes patterns for with and without CSS Modules, with PostCSS and with additional webpack configurations on top of the next-less plugin.
2 changes: 1 addition & 1 deletion examples/with-react-ga/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ now

## The idea behind the example

This example shows the most basic way to use [react-ga](https://github.com/react-ga/react-ga) using custom [App](https://github.com/zeit/next.js#custom-app)
This example shows the most basic way to use [react-ga](https://github.com/react-ga/react-ga) using custom [App](https://github.com/zeit/next.js#custom-app)
component with NextJs. Modify `Tracking ID` in `utils/analytics.js` file for testing this example.
6 changes: 3 additions & 3 deletions examples/with-react-with-styles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ now

## The idea behind the example

This example features how you use a different styling solution than [styled-jsx](https://github.com/zeit/styled-jsx) that also supports universal styles.
That means we can serve the required styles for the first render within the HTML and then load the rest in the client.
This example features how you use a different styling solution than [styled-jsx](https://github.com/zeit/styled-jsx) that also supports universal styles.
That means we can serve the required styles for the first render within the HTML and then load the rest in the client.
In this case we are using [react-with-styles](https://github.com/airbnb/react-with-styles).

For this purpose we are extending the `<Document />` and injecting the server side rendered styles into the `<head>`.

We are using `pages/_index.js` from this example [with-aphrodite](https://github.com/zeit/next.js/tree/master/examples/with-aphrodite).
We are using `pages/_index.js` from this example [with-aphrodite](https://github.com/zeit/next.js/tree/master/examples/with-aphrodite).
8 changes: 4 additions & 4 deletions examples/with-redux-observable/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ the default export from

We transform the Observable we get from `ajax` into a Promise in order to await
its resolution. That resolution should be a action (since the epic returns
Observables of actions). We immediately dispatch that action to the store.
Observables of actions). We immediately dispatch that action to the store.

This server-side solution allows compatibility with Next. It may not be
something you wish to emulate. In other situations, calling or awaiting epics
directly and passing their result to the store would be an anti-pattern. You
should only trigger epics by dispatching actions. This solution may not
generalise to resolving more complicated sets of actions.
generalise to resolving more complicated sets of actions.

The layout of the redux related functionality is split between:

Expand All @@ -85,5 +85,5 @@ The layout of the redux related functionality is split between:
and organized in `redux/index.js`.

Excepting in those manners discussed above, the configuration is similar the
configuration found in [with-redux example](https://github.com/zeit/next.js/tree/canary/examples/with-redux)
and [redux-observable docs](https://redux-observable.js.org/).
configuration found in [with-redux example](https://github.com/zeit/next.js/tree/canary/examples/with-redux)
and [redux-observable docs](https://redux-observable.js.org/).
6 changes: 3 additions & 3 deletions examples/with-refnux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ now

## The idea behind the example

This example, just like `with-redux` and `with-mobx` examples, shows how to manage a global state in your web-application.
This example, just like `with-redux` and `with-mobx` examples, shows how to manage a global state in your web-application.
In this case we are using [refnux](https://github.com/algesten/refnux) which is an alternative, simpler, purely functional store state manager.

We have two very similar pages (page1.js, page2.js). They both

- show the current application state, including a simple counter value
- have a link to jump from one page to the other
- have an 'increment' button to increment the state of the counter
- have an 'increment' button to increment the state of the counter
(it triggers the `counterIncrement` action)

When running the example, please, increment the counter and note how moving from page 1 to page 2 and back the state is persisted.
When running the example, please, increment the counter and note how moving from page 1 to page 2 and back the state is persisted.
Reloading any of the pages will restore the initial state coming from the server.


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": [
"tslint-config-standard",
"tslint:latest",
"tslint:latest",
"tslint-react"
],
"rules": {
Expand All @@ -12,7 +12,7 @@
"no-console": false,
"no-object-literal-type-assertion": false,
"no-submodule-imports": [
true,
true,
"next"
],
"no-unused-variable": false,
Expand Down Expand Up @@ -48,4 +48,4 @@
"check-type-operator"
]
}
}
}
14 changes: 7 additions & 7 deletions packages/next/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,35 +86,35 @@ export default function getBaseWebpackConfig (dir: string, {dev = false, isServe
if (notExternalModules.indexOf(request) !== -1) {
return callback()
}

resolve(request, { basedir: dir, preserveSymlinks: true }, (err, res) => {
if (err) {
return callback()
}

if (!res) {
return callback()
}

// Default pages have to be transpiled
if (res.match(/next[/\\]dist[/\\]/) || res.match(/node_modules[/\\]@babel[/\\]runtime[/\\]/) || res.match(/node_modules[/\\]@babel[/\\]runtime-corejs2[/\\]/)) {
return callback()
}

// Webpack itself has to be compiled because it doesn't always use module relative paths
if (res.match(/node_modules[/\\]webpack/) || res.match(/node_modules[/\\]css-loader/)) {
return callback()
}

// styled-jsx has to be transpiled
if (res.match(/node_modules[/\\]styled-jsx/)) {
return callback()
}

if (res.match(/node_modules[/\\].*\.js$/)) {
return callback(undefined, `commonjs ${request}`)
}

callback()
})
}
Expand Down
Loading

0 comments on commit d9060f5

Please sign in to comment.