-
Notifications
You must be signed in to change notification settings - Fork 26.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
130 changed files
with
2,232 additions
and
626 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"recommendations": [ | ||
// Linting / Formatting | ||
"rust-lang.rust-analyzer", | ||
"esbenp.prettier-vscode", | ||
"dbaeumer.vscode-eslint", | ||
"usernamehw.errorlens", | ||
|
||
// Testing | ||
"orta.vscode-jest", | ||
|
||
// PR management / Reviewing | ||
"github.vscode-pull-request-github", | ||
|
||
// Showing todo comments | ||
"gruntfuggly.todo-tree", | ||
|
||
// Collaborating | ||
"ms-vsliveshare.vsliveshare", | ||
|
||
// Debugging | ||
"ms-vscode.vscode-js-profile-flame" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,54 @@ | ||
{ | ||
// Formatting using Prettier by default for all languages | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
// Formatting using Prettier for JavaScript, overrides VSCode default. | ||
"[javascript]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
// Formatting using Rust-Analyzer for Rust. | ||
"[rust]": { | ||
"editor.defaultFormatter": "rust-lang.rust-analyzer" | ||
}, | ||
// Linting using ESLint. | ||
"eslint.validate": [ | ||
"javascript", | ||
"javascriptreact", | ||
{ "language": "typescript", "autoFix": true }, | ||
{ "language": "typescriptreact", "autoFix": true } | ||
"typescript", | ||
"typescriptreact" | ||
], | ||
"debug.javascript.unmapMissingSources": true, | ||
// Disable Jest autoRun as otherwise it will start running all tests the first time. | ||
"jest.autoRun": "off", | ||
|
||
// Debugging. | ||
"debug.javascript.unmapMissingSources": true, | ||
|
||
"files.exclude": { | ||
"**/node_modules": false, | ||
"node_modules": true, | ||
"*[!test]**/node_modules": true | ||
} | ||
}, | ||
|
||
// Ensure enough terminal history is preserved when running tests. | ||
"terminal.integrated.scrollback": 10000, | ||
|
||
// Configure todo-tree to exclude node_modules, dist, and compiled. | ||
"todo-tree.filtering.excludeGlobs": [ | ||
"**/node_modules", | ||
"**/dist", | ||
"**/compiled" | ||
], | ||
// Match TODO-APP in addition to other TODOs. | ||
"todo-tree.general.tags": [ | ||
"BUG", | ||
"HACK", | ||
"FIXME", | ||
"TODO", | ||
"XXX", | ||
"[ ]", | ||
"[x]", | ||
"TODO-APP" | ||
], | ||
|
||
// Disable TypeScript surveys. | ||
"typescript.surveys.enabled": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# createContext in a Server Component | ||
|
||
#### Why This Error Occurred | ||
|
||
You are using `createContext` in a Server Component but it only works in Client Components. | ||
|
||
#### Possible Ways to Fix It | ||
|
||
Mark the component using `createContext` as a Client Component by adding `'use client'` at the top of the file. | ||
|
||
##### Before | ||
|
||
```jsx | ||
import { createContext } from 'react' | ||
|
||
const Context = createContext() | ||
``` | ||
|
||
##### After | ||
|
||
```jsx | ||
'use client' | ||
import { createContext } from 'react' | ||
|
||
const Context = createContext() | ||
``` | ||
|
||
### Useful Links | ||
|
||
[Server and Client Components](https://beta.nextjs.org/docs/rendering/server-and-client-components#context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,59 @@ | ||
# No Img Element | ||
# No img element | ||
|
||
> Prevent usage of `<img>` element to prevent layout shift. | ||
> Prevent usage of `<img>` element to prevent layout shift and favor [optimized images](https://nextjs.org/docs/basic-features/image-optimization). | ||
### Why This Error Occurred | ||
|
||
An `<img>` element was used to display an image. Use either `<picture>` in conjunction with `<img>` element, or use `next/image` that has better performance and automatic Image Optimization over `<img>`. | ||
An `<img>` element was used to display an image. | ||
|
||
### Possible Ways to Fix It | ||
|
||
Import and use the `<Image />` component: | ||
Use [`next/image`](https://nextjs.org/docs/api-reference/next/image) to improve performance with automatic [Image Optimization](https://nextjs.org/docs/basic-features/image-optimization). | ||
|
||
> Note: If deploying to a [managed hosting provider](https://nextjs.org/docs/deployment), remember to check pricing since optimized images might be charged differently that the original images. If self-hosting, remember to install [`sharp`](https://www.npmjs.com/package/sharp) and check if your server has enough storage to cache the optimized images. | ||
```jsx | ||
import Image from 'next/image' | ||
|
||
function Home() { | ||
return ( | ||
<> | ||
<Image | ||
src="https://example.com/test" | ||
alt="Landscape picture" | ||
width={500} | ||
height={500} | ||
/> | ||
</> | ||
<Image | ||
src="https://example.com/hero.jpg" | ||
alt="Landscape picture" | ||
width={800} | ||
height={500} | ||
/> | ||
) | ||
} | ||
|
||
export default Home | ||
``` | ||
|
||
If you would like to use `next/image` featrues such as blur-up placeholders but disable Image Optimization, you can do so using [unoptimized](https://nextjs.org/docs/api-reference/next/image#unoptimized). | ||
|
||
<br /> | ||
|
||
Use `<picture>` in conjunction with `<img>` element: | ||
Or, use a `<picture>` element with the nested `<img>` element: | ||
|
||
```jsx | ||
function Home() { | ||
return ( | ||
<> | ||
<picture> | ||
<source srcSet="https://example.com/test" type="image/webp" /> | ||
<img src="https://example.com/test" alt="Landscape picture" /> | ||
</picture> | ||
</> | ||
<picture> | ||
<source srcSet="https://example.com/hero.avif" type="image/avif" /> | ||
<source srcSet="https://example.com/hero.webp" type="image/webp" /> | ||
<img | ||
src="https://example.com/hero.jpg" | ||
alt="Landscape picture" | ||
width={800} | ||
height={500} | ||
/> | ||
</picture> | ||
) | ||
} | ||
``` | ||
|
||
### Useful Links | ||
|
||
- [Image Component and Image Optimization](https://nextjs.org/docs/basic-features/image-optimization) | ||
- [next/image API Reference](https://nextjs.org/docs/api-reference/next/image) | ||
- [Largest Contentful Paint (LCP)](https://nextjs.org/learn/seo/web-performance/lcp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.