[Docs] Add config types to all examples (#40083)

<!--
Thanks for opening a PR! Your contribution is much appreciated.
In order to make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

## Summary

- Added jsdoc typing for all examples using `next.config.js`
- Added jsdoc typing for all examples using `tailwind.config.js`

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm lint`
- [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
This commit is contained in:
Henrik Wenz 2022-08-31 23:41:22 +02:00 committed by GitHub
parent e7e567b1fc
commit 92aafcbcf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
70 changed files with 71 additions and 5 deletions

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
async rewrites() { async rewrites() {
return [ return [

View file

@ -1,8 +1,8 @@
/** @type {import('next').NextConfig} */
const withBundleAnalyzer = require('@next/bundle-analyzer')({ const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true', enabled: process.env.ANALYZE === 'true',
}) })
/** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
// any configs you need // any configs you need
} }

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: ['./components/**/*.tsx', './pages/**/*.tsx'], content: ['./components/**/*.tsx', './pages/**/*.tsx'],
theme: { theme: {

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
mode: 'jit', mode: 'jit',
purge: ['./pages/**/*.js', './components/**/*.js'], purge: ['./pages/**/*.js', './components/**/*.js'],

View file

@ -1,10 +1,10 @@
/** @type {import('next').NextConfig} */
const withNextra = require('nextra')({ const withNextra = require('nextra')({
theme: 'nextra-theme-blog', theme: 'nextra-theme-blog',
themeConfig: './theme.config.js', themeConfig: './theme.config.js',
// optional: add `unstable_staticImage: true` to enable Nextra's auto image import // optional: add `unstable_staticImage: true` to enable Nextra's auto image import
}) })
/** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
// any configs you need // any configs you need
} }

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}',

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
images: { images: {
domains: ['cdn.builder.io'], domains: ['cdn.builder.io'],

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: ['./components/**/*.js', './pages/**/*.js'], content: ['./components/**/*.js', './pages/**/*.js'],
theme: { theme: {

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
reactStrictMode: true, reactStrictMode: true,
async rewrites() { async rewrites() {

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
images: { images: {
loader: 'custom', loader: 'custom',

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}',

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
images: { images: {
domains: ['imgix.cosmicjs.com'], domains: ['imgix.cosmicjs.com'],

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}',

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
images: { images: {
domains: ['www.datocms-assets.com'], domains: ['www.datocms-assets.com'],

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}',

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
images: { images: {
domains: [process.env.NEXT_IMAGE_DOMAIN], domains: [process.env.NEXT_IMAGE_DOMAIN],

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}',

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
images: { images: {
domains: ['static.ghost.org'], domains: ['static.ghost.org'],

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}',

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
images: { images: {
domains: ['media.graphcms.com'], domains: ['media.graphcms.com'],

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}',

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}',

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
images: { images: {
domains: ['b-cdn.net'], domains: ['b-cdn.net'],

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}',

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
images: { images: {
domains: ['images.prismic.io'], domains: ['images.prismic.io'],

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}',

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
experimental: { experimental: {
images: { images: {

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}',

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}',

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
images: { images: {
domains: ['localhost'], domains: ['localhost'],

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}',

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}',

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: ['./components/**/*.js', './pages/**/*.js'], content: ['./components/**/*.js', './pages/**/*.js'],
theme: { theme: {

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
images: { images: {
domains: ['media.umbraco.io'], domains: ['media.umbraco.io'],

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}',

View file

@ -5,6 +5,7 @@ if (!process.env.WORDPRESS_API_URL) {
`) `)
} }
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
images: { images: {
domains: [ domains: [

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}',

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
basePath: '/gh-pages-test', basePath: '/gh-pages-test',
} }

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
async headers() { async headers() {
return [ return [

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
i18n: { i18n: {
locales: ['en', 'fr', 'nl'], locales: ['en', 'fr', 'nl'],

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
images: { images: {
domains: ['assets.vercel.com'], domains: ['assets.vercel.com'],

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
experimental: { experimental: {
modularizeImports: { modularizeImports: {

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
experimental: { experimental: {
reactRemoveProperties: true, reactRemoveProperties: true,

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
// Uncomment the line below to enable basePath, pages and // Uncomment the line below to enable basePath, pages and
// redirects will then have a path prefix (`/app` in this case) // redirects will then have a path prefix (`/app` in this case)

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
experimental: { experimental: {
removeConsole: { removeConsole: {

View file

@ -1,6 +1,4 @@
/** @type {import("next").NextConfig} */ /** @type {import("next").NextConfig} */
const config = { module.exports = {
reactStrictMode: true, reactStrictMode: true,
} }
module.exports = config

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
async rewrites() { async rewrites() {
return [ return [

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
webpack: (config) => { webpack: (config) => {
config.module.rules.push({ config.module.rules.push({

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
output: 'standalone', output: 'standalone',
} }

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
output: 'standalone', output: 'standalone',
} }

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
distDir: '../.next', distDir: '../.next',
} }

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
/* this needs to be set to false until a bug in the compression npm module gets fixed. /* this needs to be set to false until a bug in the compression npm module gets fixed.
reference: https://github.com/expressjs/compression/issues/122 reference: https://github.com/expressjs/compression/issues/122

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
i18n: { i18n: {
locales: ['en', 'de'], locales: ['en', 'de'],

View file

@ -1,5 +1,7 @@
const path = require('path') const path = require('path')
const CopyPlugin = require('copy-webpack-plugin') const CopyPlugin = require('copy-webpack-plugin')
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
webpack: (config) => { webpack: (config) => {
config.plugins.push( config.plugins.push(

View file

@ -1,5 +1,6 @@
const { locales, sourceLocale } = require('./lingui.config.js') const { locales, sourceLocale } = require('./lingui.config.js')
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
i18n: { i18n: {
locales, locales,

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
reactStrictMode: true, reactStrictMode: true,
} }

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}',

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
webpack: (configuration) => { webpack: (configuration) => {
configuration.module.rules.push({ configuration.module.rules.push({

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
webpack: (config) => { webpack: (config) => {
config.resolve.alias = { config.resolve.alias = {

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
mode: 'jit', mode: 'jit',
purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'], purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
webpack: (config, { isServer }) => { webpack: (config, { isServer }) => {
if (isServer) { if (isServer) {

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
reactStrictMode: true, reactStrictMode: true,
} }

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
webpack: function (config) { webpack: function (config) {
config.externals = config.externals || {} config.externals = config.externals || {}

View file

@ -1,5 +1,6 @@
const colors = require('tailwindcss/colors') const colors = require('tailwindcss/colors')
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'], purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
darkMode: 'class', darkMode: 'class',

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
webpack(config, options) { webpack(config, options) {
config.module.rules.push({ config.module.rules.push({

View file

@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
mode: 'jit', mode: 'jit',
purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'], purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
webpack(config) { webpack(config) {
config.output.webassemblyModuleFilename = 'static/wasm/[modulehash].wasm' config.output.webassemblyModuleFilename = 'static/wasm/[modulehash].wasm'

View file

@ -1,5 +1,6 @@
const path = require('path') const path = require('path')
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
webpack(config, { dev, isServer }) { webpack(config, { dev, isServer }) {
if (dev && !isServer) { if (dev && !isServer) {

View file

@ -1,3 +1,4 @@
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
basePath: '/blog', basePath: '/blog',
} }

View file

@ -1,5 +1,6 @@
const { BLOG_URL } = process.env const { BLOG_URL } = process.env
/** @type {import('next').NextConfig} */
module.exports = { module.exports = {
async rewrites() { async rewrites() {
return [ return [