Commit graph

662 commits

Author SHA1 Message Date
Kyle Holmberg
e5960dc6d6
Add Stitches example to CSS-in-JS docs (#29498)
CC @peduarte
2021-09-29 16:50:41 +00:00
Lee Robinson
7f99895076
Update imperative routing docs to have better a11y (#29382)
We should recommend using a `button` instead of a `span` 👍
2021-09-27 02:04:58 +00:00
Casper
9343b67c11
feat: allow setting custom tsconfig file (#28104)
Ability to provide a custom tsconfig file. 

**Example Usage:**

```js
// next.config.js
module.exports = {
	typescript: {
		tsconfigPath: "myconfig.json"
	}
}
```


## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [x] Related issues linked using [`fixes #23972 (discussion)`](https://github.com/vercel/next.js/discussions/23972)
- [x] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes
2021-09-23 22:52:05 +00:00
JJ Kasper
f8e283c7ba
Ensure href/as behavior points to correct docs (#29270)
Adds an additional note about `href`/`as` behavior so that users understand which docs should be looked at for how they are using it. 


## Documentation / Examples

- [x] Make sure the linting passes


x-ref: https://github.com/vercel/next.js/issues/26169#issuecomment-924206396
2021-09-22 19:07:07 +00:00
Lee Robinson
638e6ccfde
Update Gatsby migration guide to use image imports. (#29178)
* Update Gatsby migration guide to use image imports.

* Update docs/migrating/from-gatsby.md

* Update docs/migrating/from-gatsby.md

Co-authored-by: Steven <steven@ceriously.com>

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-09-19 00:12:31 -05:00
Konstantin Popov
2333f7c1b8
Fix minor typos (#29188)
Fix minor typos:

typescript -> TypeScript
2021-09-17 23:00:20 +00:00
x4th
37c66dcd84
Update router.prefetch section to clarify it supports dynamic routes (#29070)
* Update router.prefetch section to clarify it supports dynamic routes

* Apply suggestions from code review

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-09-17 11:18:02 -05:00
Colin Sidoti
713a5aa701
Use new @clerk/nextjs package in with-clerk example, update Next.js authentication docs (#28906)
* Update headings to clarify that we're describing. Add heading for Authentication API Routes

* Start adding API route examples

* Start adding API route examples

* Start adding API route examples

* Start adding API route examples

* auth: Replace clerk packages with @clerk/nextjs

* Add API authentication example to with-clerk

* Fix footer links

* Proofread, ensure consistency

* Update example's props to use new version

* Update example links

* Add rel tag to _blank link

* Obscure the authentication provider in the example

* Replace example

* Reset authentication docs, list Clerk as vendor

* Re-fix typo

* Change sample to example

* Add the example

* Update examples/with-clerk/package.json

Co-authored-by: Lee Robinson <me@leerob.io>

Co-authored-by: Peter Perlepes <p.perlepes@gmail.com>
Co-authored-by: Lee Robinson <me@leerob.io>
2021-09-17 10:54:34 -05:00
JJ Kasper
cefd9cf283
Add crawler blocking for fallback: true (#29121)
* Add crawler blocking for fallback: true

* update test

* Update check

* Add note to docs

* use browser agent for non-crawler test
2021-09-16 11:01:28 -05:00
Ty Mick
c7e187f893
Add client-side debugging instructions (#28815)
Fixes #16442

The current instructions on the Debugging page currently only work for server-side code, and furthermore, the page doesn't actually _say_ that they only work for server-side code.

This update adds instructions for debugging client-side code in both VS Code and Chrome DevTools. It also improves the suggested VS Code launch configurations to take advantages of some relatively recent features in VS Code's [built-in JavaScript debugger][1]. Using the `node-terminal` and `pwa-chrome` launch types removes the need to manually pass an `--inspect` flag to the underlying Node.js process.

[1]: https://github.com/microsoft/vscode-js-debug

Let me know if there are any edge cases I didn't consider with these VS Code launch configs!



## Documentation / Examples

- [x] Make sure the linting passes
2021-09-16 07:07:56 +00:00
Lee Robinson
a5bc3f2f8c
Add note about using Sharp for next/image to deployment docs. (#29067)
I also removed the custom server link here, because I think it's making too strong of a correlation between custom server and Node.js server using `next start`, which aren't the same.
2021-09-13 20:31:04 +00:00
volcareso
48b37ede23
Add more examples of static generation to docs page. (#29052)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
2021-09-13 13:18:31 +00:00
volcareso
e09b7a5827
Fixed typo (#28989)
Added () outside *demo"



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
2021-09-10 12:18:43 +00:00
Nwachukwu Daniel (DONSN)
248c6fc88d
Fixed issue with grammar (#28964)
Changed - function component to - functional component in the heading and sentence below:

If the child of `Link` is a functional component, in addition to using `passHref`, you must wrap the component



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
2021-09-09 14:24:01 +00:00
scottrepreneur
ee71f9d863
name should be key (#28917)
Small fix on parameter expecting to be de-duped
2021-09-08 14:00:34 +00:00
Lee Robinson
1fcd8c2e4d
Update next/link API docs to mention a11y and ESLint rule. (#28841)
Based on feedback from Twitter. 

https://twitter.com/marcysutton/status/1431432062506917890
2021-09-07 15:10:27 +00:00
Alex Vilchis
2425f4703c
(docs) Add permanent property in redirect object (#28852)
I found that an example for a redirect rule in the documentation doesn't have the required property `permanent`. I noticed this because I tried to use that same rule but building fails with the following message:

```
`permanent` is not set to `true` or `false` for route {"source":"/:path((?!another-page$).*)","has":[{"type":"host","value":"example.com"}],"destination":"/another-page"}


Error: Invalid redirect found
```

My PR simply adds the missing `permanent` property as false to be consistent with the rest.

## Documentation / Examples

- [x] Make sure the linting passes
2021-09-06 23:20:15 +00:00
Alex Vilchis
947db315cf
(docs) Remove duplicate comma (#28850)
- [X] Make sure the linting passes
2021-09-06 18:31:31 +00:00
Woosik Kim
970f85e40c
doc: fix typo (#28817)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-09-06 13:42:18 +02:00
Lee Robinson
602b26b4b9
Add note to Gatsby migration guide about using next/image with custom loaders. (#28805)
Feedback from this article: https://blog.whereisthemouse.com/image-optimization-for-static-nextjs-sites
2021-09-06 11:34:22 +00:00
Houssein Djirdeh
4141aaefa5
[ESLint] Support single-file linting in next lint (necessary for lint-staged) (#28042)
Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-09-06 13:05:40 +02:00
Steven
801e48eae9
Update docs to clarify that image imports are static (#28744)
This PR clarifies the usage for static image imports.
2021-09-02 18:51:30 +00:00
Alex Castle
c9efbe1818
Update image styling doc (#28724)
In talking to partners, I've seen a lot of confusion about the number of wrapping `<div>`s around the image element rendered by `next/image`. There's always just one single wrapper--this PR updates the docs to make that a little more explicit.
2021-09-02 05:48:55 +00:00
Aleksa Cukovic
501bfe6969
Update docs about exposing env vars to the browser (#28673)
Current docs on exposing environment variables to the browser are slightly misleading as they say that variables loaded from `.env.local` are only available in node by default, but this is the case for all environment variables not just those loaded from `.env.local`.

## Documentation

- [x] Make sure the linting passes
2021-08-31 21:18:22 +00:00
Kara
9be387c7f4
getServerSideProps should support props value as Promise (#28607)
Previous to this change, getServerSideProps could only return plain objects
for props, e.g.:

```javascript
export async function getServerSideProps() {
  return {
    props: {
      text: 'some value',
    }
  }
}
```

With this commit, the props object can also be a Promise, e.g.

```javascript
export async function getServerSideProps() {
  return {
    props: (async function () {
      return {
        text: 'promise value',
      }
    })(),
  }
}
```

For now, the framework simply waits for the results of the props Promise to resolve,
but this small change sets the groundwork for later allowing props to be streamed (cc @devknoll).

## Feature

- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. -- *This is part of @devknoll's ongoing work to support streaming.*
- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not. *not sure if this applies here*
- [ ] Errors have helpful link attached, see `contributing.md`
2021-08-30 19:52:15 +00:00
Mike Hedman
d209435724
Small grammar fixes (#28590)
"exclusive of" implies that it doesn't pertain to `export` https://www.merriam-webster.com/dictionary/exclusive%20of  "Exclusive to" implies that it's only relevant to `export`.  
Also changed "can not" to "cannot".



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
2021-08-28 21:56:32 +00:00
Scotty Waggoner
04cc37f763
Add docs for using pageExtensions to colocate other files with page components (#22740)
Feel free to edit this/suggest changes as you see fit to match the style of your docs or how you want this feature represented.

There seemed to be many issues regarding colocating non-page files with page components in  the `pages` directory where `pageExtensions` was finally suggested as a solution. I think it would be great to document it better since it seems to be a often requested workflow to colocate test, generated files, styles, and other files needed by page components in the `pages` directory. The note that exists in the docs currently alludes to the ability to do this but it doesn't contain much context that would help make it more discoverable.

Relevant issues:
https://github.com/vercel/next.js/discussions/11113#discussioncomment-427139
https://github.com/vercel/next.js/issues/8454#issuecomment-560432659
https://github.com/vercel/next.js/issues/8617#issuecomment-790030032
https://github.com/vercel/next.js/issues/3728#issuecomment-523789071
2021-08-27 22:58:56 +00:00
Delba de Oliveira
27c2937cc7
Update with-jest packages and docs (#28209)
This PR updates the with-jest example to the latest version of Jest and adds a note about the Jest and RTL testing environments (related to this [discussion](https://github.com/vercel/next.js/discussions/28337)). Also adds minor tweaks to the testing docs. 


## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes
2021-08-26 16:18:22 +00:00
Hunter Tunnicliff
877f982924
Use recommended pattern in testing example (#28404)
* Use recommended pattern in testing example

Since the official linter for testing library, `eslint-plugin-testing-library` recommends using `screen` to write queries, this MR updates the testing library example to follow the pattern recommended by the linter.

> DOM Testing Library (and other Testing Library frameworks built on top of it) exports a screen object which has every query (and a debug method). This works better with autocomplete and makes each test a little simpler to write and maintain.

> This rule aims to force writing tests using built-in queries directly from screen object rather than destructuring them from render result. Given the screen component does not expose utility methods such as rerender() or the container property, it is correct to use the render returned value in those scenarios.

See the `prefer-screen-queries` rules docs for more info: https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-screen-queries.md

* Update devDependencies

* Install and configure test linting

* Use recommended pattern in test

* Update test names for consistency

* Update docs

* Set jest environment in each file

* Use root true in `with-jest` eslint config

* Ensure nested .eslintrcs are not loaded for repo lint

Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
2021-08-25 12:33:57 -05:00
JJ Kasper
f21685549a
Update i18n locales limit to warning (#28429)
* Update i18n locales limit to warning

* update version -> versions

* bump

* Use Log.warn instead

* Apply suggestions from code review

Co-authored-by: Lee Robinson <me@leerob.io>


Co-authored-by: Lee Robinson <me@leerob.io>
2021-08-25 08:54:38 -05:00
Steven
cb6290adf3
Update docs for sharp usage to mention Vercel (#28476)
There was some confusion in [this tweet](https://twitter.com/mtliendo/status/1430269174459338759) so I revised the docs around `sharp` usage.
2021-08-24 22:51:28 +00:00
Robbie Averill
57965770b9
Minor docs edit: cors -> CORS (#28472)
## Documentation / Examples

- [x] Make sure the linting passes
2021-08-24 17:23:40 +00:00
Houssein Djirdeh
80921b6a54
enables eslint caching by default (#28349)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-08-23 12:56:21 -05:00
Lee Robinson
8afa24fca5
Improved next/image docs around layouts. (#28345)
There's been community feedback the `layouts` section of `next/image` docs could be improved. Thanks to this great article (https://blog.eyas.sh/2021/08/gatsby-to-next-js/), I've added a helpful table here giving a high-level overview, as well as re-organized the `layout` section to be more helpful.
2021-08-23 17:39:19 +00:00
Kornel Dubieniecki
d143d9879f
docs: update font-optimization.md (#28397)
Adding display property to the examples as just copying them shows a 'Display parameter is missing.' warning.
Also added a link to the docs.

## Documentation / Examples

- [ ] Make sure the linting passes
2021-08-23 16:07:54 +00:00
Behzad Mehrabi
d6e82484f4
fix link to global stylesheet in from-create-react-app.md (#28327) 2021-08-20 12:18:27 +00:00
Aryan Beezadhur
864a1893c3
Update supported-browsers-features.md (#28326) 2021-08-20 11:52:20 +00:00
stefanprobst
da4203d032
Add eslint rule for id attribute on inline next/script (#27853)
This adds a new ESLint rule to `eslint-plugin-next` to check that `next/script` components with inline content have the required `id` attribute.

Also adjusted the code example for inline scripts in the `next/script` docs, which were actually missing an `id` attribute.
And also updated the `next/scripts` integration test to also have the required `id` attribute.

Unsure about the required heading levels in the errors .md document (other examples have h1 and h4??)

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [x] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
2021-08-19 20:08:04 +00:00
Brody McKee
0d3fb75cb6
Add docs for ESLint plugin settings and rule options (#28059)
This PR adds documentation for the new `rootDir` setting (#27918), and for `next/no-html-link-for-pages`.

## Documentation / Examples

- [x] Make sure the linting passes
2021-08-19 09:07:30 +00:00
Jiachi Liu
7ea7c23866
Document usage of suspense option of next/dynamic (#28210)
## Documentation / Examples

- [x] Make sure the linting passes
- [x] Errors have helpful link attached, see `contributing.md` (for #28165, #27611)
- [x] Update test case
2021-08-18 01:21:22 +00:00
Kevin Old
fe246bae36
docs: Add link to Cypress GitHub Actions Guide to Testing docs (#28207)
@leerob 

This pull request points to our [Cypress GitHub Actions Guide](https://on.cypress.io/github-actions) in the Cypress Documentation site.  It contains a guided walkthrough of using GitHub Actions with Cypress in text and our [recently released videos](https://on.cypress.io/ci-gha-playlist) in context. 

## Documentation / Examples

- [x] Make sure the linting passes
2021-08-17 17:55:24 +00:00
Urko Pineda
5d4d8802b8
Update testing.md (#28190)
Removed "`" with "'".



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes
2021-08-17 14:06:21 +00:00
Rahul Gaba
da4d65252f
ESLint Plugin: Prefer next script component when using the inline script for Google Analytics. (#25147)
* Add a lint rule for using next script component when using inline script for Google Analytics.

* Apply suggestions from code review

Co-authored-by: JJ Kasper <jj@jjsweb.site>

* Update errors/next-script-for-ga.md

Co-authored-by: JJ Kasper <jj@jjsweb.site>

* Apply suggestions from code review

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-08-16 13:55:07 -05:00
Shun Tedokon
385ac94afd
docs: corrected the link to the example (#28175)
## Documentation

- Corrected the link in the **Next.js Testing Docs** to the correct one.
2021-08-16 17:15:21 +00:00
Oscar Fuentes
639b4d7d1f
doc: fix typo (#28146)
Given the context of the surrounding sentence, I believe the intention here was to use the word `increasing`. 



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
2021-08-16 02:51:06 +00:00
Lee Robinson
d5dc968134
Improve React Strict Mode documentation. (#28139)
The current text linked wasn't obvious. Plus, the best description of what Strict Mode is was at the bottom of the document.
2021-08-15 17:44:00 +00:00
Sam Poder
d57d9a5173
Add a Styling Section to next/image component docs (#28055)
## Feature

- [x] Documentation added

## Documentation / Examples

- [x] Make sure the linting passes

It seems that people currently struggle to style their image: https://twitter.com/achrlswrth/status/1425695122029744128, this clarifies that you can use className to do this (something I just learnt!). At the moment, this is kind of hidden in "other props" I think this makes it more clear for people

Thanks,

Sam
2021-08-14 03:56:33 +00:00
Gustav Pursche
22dbf275fe
Docs: Mention 3rd option 'blocking' for fallback (#28077)
* Docs: Mention 3rd option 'blocking' for fallback

* Update docs/basic-features/data-fetching.md

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-08-13 22:48:41 -05:00
Delba de Oliveira
04794776d8
[DOCS] Update testing docs (#28064)
This PR adds a recommendation to test production code with Cypress and re-orders the page information. 

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes
2021-08-13 12:01:12 +00:00
Delba de Oliveira
40f85f6d95
[Docs] Add testing docs (#27965)
Add a new doc showing how to configure Jest and Cypress with Next.js

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples
- [x] Make sure the linting passes
2021-08-11 20:47:12 +00:00