Commit graph

9041 commits

Author SHA1 Message Date
Knut Melvær
36d922fbda
Add apiVersion to config (#28610)
The client now warns against missing `apiVersion` ([docs](https://www.sanity.io/docs/api-versioning)). This PR adds the config for using the latest API version. There shouldn't be breaking changes in this app.



## 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-30 17:37:13 +00:00
Steven
a60690f59b v11.1.1-canary.18 2021-08-30 13:06:42 -04:00
Steven
7afc97c574
Add CSP to Image Optimization API (#28620)
Add CSP header to Image Optimization API
2021-08-30 16:51:47 +00:00
Anderson Leite
8711c5ca53
Tests: Remove unnecessary await (#28594)
'await' has no effect on the type of this expression.ts(80007)

## Bug

- [X] Integration tests clean up

## Documentation / Examples

- [x] Make sure the linting passes
2021-08-29 06:50:00 +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
JJ Kasper
f1dbc9260d
Ensure dev server side errors are correct (#28520) 2021-08-27 14:29:30 +02: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
Gerald Monaco
2cc2cb4f77
Support for functional Document components (#28515) 2021-08-26 10:05:01 -05:00
Steven
d8093ec4b4
Update warning when parent styles break next/image (#28517)
- Follow up to #28221 
- Fixes #27644
2021-08-26 00:09:04 +00:00
Steven
ed6ce1ae27 v11.1.1-canary.17 2021-08-25 15:25:53 -04:00
Houssein Djirdeh
9442925f50
handle edge case for no-import-document rule (#28261)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-08-25 13:30:49 -05:00
Ado Kukic
220fa9cd14
Update to use the latest MongoDB best practices to limit connection pooling issues. (#28350)
* Update to use the latest MongoDB best practices.

* lint-fix

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
2021-08-25 12:52:12 -05: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
Steven
d835402f28 v11.1.1-canary.16 2021-08-25 12:53:06 -04:00
JJ Kasper
ead10f1f81
Fix handling for 204 status code with a body (#28479)
This ensures we handle 204 and 304 status codes correctly in API routes.  

## Bug

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

Fixes: https://github.com/vercel/next.js/issues/28464
2021-08-25 15:52:43 +00: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
zhafri-shafiq
74c349daab
Add prop-types in package.json (#28481)
## Bug

- Related issues #28480 

This is just minor dependency fix that I noticed while going through the examples.
2021-08-25 12:53:50 +00:00
Tim Neutkens
c65248d732 Remove unused imports 2021-08-25 11:11:45 +02:00
Tim Neutkens
a509d906a6 v11.1.1-canary.15 2021-08-25 10:49:43 +02:00
Tim Neutkens
9316dc0a8e
Add default trace format that is exported automatically (#28461)
Co-authored-by: Steven <steven@ceriously.com>
2021-08-25 10:47:16 +02:00
JJ Kasper
706547e0c3
Ensure error is shown correctly for empty headers field (#28430)
* Ensure error is shown correctly for empty headers field

* Apply suggestions from code review

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

Co-authored-by: Steven <steven@ceriously.com>
2021-08-24 19:26:33 -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
Anderson Leite
4d5eaf0efb
Tests: Adds test to data-nimg data attribute based on layout prop. (#28444)
Adds tests to the Image component to verify that the correct data is being exposed.
Based on #27899 and #28312

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] 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-24 20:36:49 +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
Elliot Scribner
f78ebd0895
Fix: changing import syntax slightly to ensure success with create-next-app (#28431)
Just a small change to recently merged PR; for some reason `import couchbase from 'couchbase'` is not working correctly when I use create-next-app to bootstrap with the `with-couchbase` example, despite initially working within my local next.js directory. The wildcard import fixes that issue. Thanks!

## Documentation / Examples

- [x] Make sure the linting passes
2021-08-24 16:48:28 +00:00
Aravind Putrevu
a143bc4662
[examples] Add ElasticSearch example (#28043)
## 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-24 16:28:11 +00:00
Janicklas Ralph
fd1c56e66a
next/script fix duplicate scripts (#28428)
* Fix #27747

* Fix lint error

* Add data attribute to script component

* Fix #28036

* Fix tests

* Fix tests

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-08-24 11:07:38 -05:00
jj@jjsweb.site
ee462442c8
v11.1.1-canary.14 2021-08-24 09:54:07 -05:00
Mateusz Burzyński
c1a09471ff
Add missing typescript property to NextConfig (#28459)
This is similar to https://github.com/vercel/next.js/pull/27126 , https://github.com/vercel/next.js/pull/27446 and https://github.com/vercel/next.js/pull/27974

## 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-24 14:08:18 +00:00
JJ Kasper
005b13f1ac
Move unit tests to one folder and migrate them to TypeScript (#28427)
* Move unit tests to one folder

* Migrate unit tests to TypeScript

* add test types to lint

* Ensure ts(x) tests are run with util

* Add tsx extension to jest config

* bump
2021-08-24 07:52:45 -05:00
Elliot Scribner
6072afc83a
[examples] Added with-couchbase example (#27184)
This adds a simple `with-couchbase` example app complete with a check for successful connection (in `index.js`).

**Note:** To check the connection, this application runs a simple KV GET operation with a key that does not exist and expects a response of `document not found`. Any other response indicates a failure to connect.

Thank you!
2021-08-24 01:45:25 +00:00
JJ Kasper
ece79a4e00
Update test config to leverage swc (#28400)
This updates our `jest` configuration to no longer use `babel-jest` and instead uses `@swc/jest` which is much faster. This also updates to the latest version of `jest`, fixes our `tsconfig.json` used for tests (previously types in `node_modules` weren't resolved correctly), and ensures `next/dist` isn't un-necessarily transpiled in `jest`. 

Timings for `yarn testheadless test/unit/` on CI
- before: 3m 30s - 4m ([example run](https://github.com/vercel/next.js/runs/3394701995))
- after: under 1m ([example run](https://github.com/vercel/next.js/pull/28400/checks?check_run_id=3395161621))

Timings for `yarn testheadless test/unit/` locally on m1 mac 
- before: 90.16 seconds
- after: 29.92 seconds
2021-08-23 18:36:56 +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
vcnc-hex
00f1519ae7
Fix forked NODE_OPTIONS except for inspect (#28420) 2021-08-23 12:14:17 -05: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
Loren ☺️
29441fb7c4
Add Temporal example (#28348)
## Documentation / Examples

- [x] Make sure the linting passes
2021-08-23 15:41:59 +00:00
JJ Kasper
83209a4be4
Ensure @babel/core is de-duped when nccing (#28384)
* Ensure @babel/core is de-duped when nccing

* lint-fix

* ncc babel packages together

* remove un-needed env

* bump
2021-08-22 14:06:58 -05:00
Janicklas Ralph
26255a685d
Add data attribute to script component (#28310)
Add data attribute `data-nscript` to the script component
2021-08-20 20:48:48 +00:00
Jesse Jafa
8737ac08fc
feat: upgrade swc/core to 1.2.80 (#28347)
* feat: upgrade swc/core to 1.2.80

* fix: add lock file
2021-08-20 14:54:21 -05:00
Alex Castle
a0f64ba4a5
Add layout to data-nimg attribute (#28312) 2021-08-20 14:43:44 +02: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
Jiachi Liu
b74ffffa96
Fix next env vars injection in dynamic (#28309)
* Treat `next/dynamic` as non external modules
* add feature flags to webpack cache version
2021-08-20 03:50:11 +00:00
hiro
a9c1bd797d
Fixed typos that existed on some files (#28314)
* fix: naviagtion -> navigation

* fix: compatability -> compatibility
2021-08-19 21:54:13 -05: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
jj@jjsweb.site
52b858a4ea
v11.1.1-canary.13 2021-08-19 12:27:49 -05:00
JJ Kasper
f525ab6909
Use temp repo copy while linking packages (#28301)
* Use temp repo copy while linking packages

* Apply suggestions from code review

Co-authored-by: Jiachi Liu <inbox@huozhi.im>

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2021-08-19 12:23:18 -05:00
Houssein Djirdeh
4e7691139f
[ESLint] Adds process.exit to next lint success output (#28299)
This PR ensures that `next lint` always exits after the process is complete. This fixes #28194.
2021-08-19 17:16:59 +00:00