Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates prettier to latest version. #51000

Merged
merged 7 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ bench/nested-deps/pages/**/*
bench/nested-deps/components/**/*

**/convex/_generated/**
**/.tina/__generated__/**
2 changes: 1 addition & 1 deletion examples/app-dir-i18n-routing/i18n-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ export const i18n = {
locales: ['en', 'de', 'cs'],
} as const

export type Locale = typeof i18n['locales'][number]
export type Locale = (typeof i18n)['locales'][number]
4 changes: 2 additions & 2 deletions examples/with-grafbase/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ const documents = {

export function graphql(
source: '\n query GetAllPosts($first: Int!) {\n postCollection(first: $first) {\n edges {\n node {\n id\n title\n slug\n }\n }\n }\n }\n'
): typeof documents['\n query GetAllPosts($first: Int!) {\n postCollection(first: $first) {\n edges {\n node {\n id\n title\n slug\n }\n }\n }\n }\n']
): (typeof documents)['\n query GetAllPosts($first: Int!) {\n postCollection(first: $first) {\n edges {\n node {\n id\n title\n slug\n }\n }\n }\n }\n']
export function graphql(
source: '\n query GetPostBySlug($slug: String!) {\n post(by: { slug: $slug }) {\n id\n title\n slug\n }\n }\n'
): typeof documents['\n query GetPostBySlug($slug: String!) {\n post(by: { slug: $slug }) {\n id\n title\n slug\n }\n }\n']
): (typeof documents)['\n query GetPostBySlug($slug: String!) {\n post(by: { slug: $slug }) {\n id\n title\n slug\n }\n }\n']

export function graphql(source: string): unknown
export function graphql(source: string) {
Expand Down
4 changes: 2 additions & 2 deletions examples/with-typescript-graphql/lib/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ const documents = {

export function graphql(
source: '\n mutation UpdateName($name: String!) {\n updateName(name: $name) {\n id\n name\n status\n }\n }\n'
): typeof documents['\n mutation UpdateName($name: String!) {\n updateName(name: $name) {\n id\n name\n status\n }\n }\n']
): (typeof documents)['\n mutation UpdateName($name: String!) {\n updateName(name: $name) {\n id\n name\n status\n }\n }\n']
export function graphql(
source: '\n query Viewer {\n viewer {\n id\n name\n status\n }\n }\n'
): typeof documents['\n query Viewer {\n viewer {\n id\n name\n status\n }\n }\n']
): (typeof documents)['\n query Viewer {\n viewer {\n id\n name\n status\n }\n }\n']

export function graphql(source: string): unknown
export function graphql(source: string) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
"postcss-pseudoelements": "5.0.0",
"postcss-short-size": "4.0.0",
"postcss-trolling": "0.1.7",
"prettier": "2.5.1",
"prettier": "2.8.8",
"pretty-bytes": "5.3.0",
"pretty-ms": "7.0.0",
"random-seed": "0.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"cross-spawn": "6.0.5",
"glob": "8.0.3",
"got": "10.7.0",
"prettier-plugin-tailwindcss": "0.2.4",
"prettier-plugin-tailwindcss": "0.3.0",
"prompts": "2.1.0",
"tar": "6.1.15",
"update-check": "1.5.4",
Expand Down
18 changes: 9 additions & 9 deletions packages/eslint-plugin-next/.swcrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"jsc": {
"parser": {
"syntax": "typescript"
}
},
"module": {
"type": "commonjs"
"$schema": "https://json.schemastore.org/swcrc",
"jsc": {
"parser": {
"syntax": "typescript"
}
}
},
"module": {
"type": "commonjs"
}
}
2 changes: 1 addition & 1 deletion packages/next/src/build/webpack-build/impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export async function webpackBuildImpl(
duration: number
pluginState: any
turbotraceContext?: TurbotraceContext
serializedPagesManifestEntries?: typeof NextBuildContext['serializedPagesManifestEntries']
serializedPagesManifestEntries?: (typeof NextBuildContext)['serializedPagesManifestEntries']
}> {
let result: CompilerResult | null = {
warnings: [],
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/build/webpack/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function traverseModules(
callback: (
mod: any,
chunk: webpack.Chunk,
chunkGroup: typeof compilation.chunkGroups[0],
chunkGroup: (typeof compilation.chunkGroups)[0],
modId: string | number
) => any
) {
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/client/image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if (typeof window === 'undefined') {
}

const VALID_LOADING_VALUES = ['lazy', 'eager', undefined] as const
type LoadingValue = typeof VALID_LOADING_VALUES[number]
type LoadingValue = (typeof VALID_LOADING_VALUES)[number]
type ImageConfig = ImageConfigComplete & {
allSizes: number[]
output?: 'standalone' | 'export'
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/client/legacy/image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if (typeof window === 'undefined') {
}

const VALID_LOADING_VALUES = ['lazy', 'eager', undefined] as const
type LoadingValue = typeof VALID_LOADING_VALUES[number]
type LoadingValue = (typeof VALID_LOADING_VALUES)[number]
type ImageConfig = ImageConfigComplete & { allSizes: number[] }
export type ImageLoader = (resolverProps: ImageLoaderProps) => string

Expand Down Expand Up @@ -194,7 +194,7 @@ const VALID_LAYOUT_VALUES = [
'responsive',
undefined,
] as const
type LayoutValue = typeof VALID_LAYOUT_VALUES[number]
type LayoutValue = (typeof VALID_LAYOUT_VALUES)[number]

type PlaceholderValue = 'blur' | 'empty'

Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/client/performance-relayer-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const WEB_VITALS = ['CLS', 'FCP', 'FID', 'INP', 'LCP', 'TTFB']
const initialHref = location.href
let isRegistered = false
let userReportHandler: ReportCallback | undefined
type Attribution = typeof WEB_VITALS[number]
type Attribution = (typeof WEB_VITALS)[number]

function onReport(metric: Metric): void {
if (userReportHandler) {
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/client/performance-relayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const WEB_VITALS = ['CLS', 'FCP', 'FID', 'INP', 'LCP', 'TTFB']
const initialHref = location.href
let isRegistered = false
let userReportHandler: ReportCallback | undefined
type Attribution = typeof WEB_VITALS[number]
type Attribution = (typeof WEB_VITALS)[number]

function onReport(metric: Metric): void {
if (userReportHandler) {
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/client/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const routerEvents = [
'hashChangeStart',
'hashChangeComplete',
] as const
export type RouterEvent = typeof routerEvents[number]
export type RouterEvent = (typeof routerEvents)[number]

const coreMethodFields = [
'push',
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/lib/eslint/runLintCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Config = {

// 0 is off, 1 is warn, 2 is error. See https://eslint.org/docs/user-guide/configuring/rules#configuring-rules
const VALID_SEVERITY = ['off', 'warn', 'error'] as const
type Severity = typeof VALID_SEVERITY[number]
type Severity = (typeof VALID_SEVERITY)[number]

function isValidSeverity(severity: string): severity is Severity {
return VALID_SEVERITY.includes(severity as Severity)
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/config-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export interface ExperimentalConfig {
*/
serverComponentsExternalPackages?: string[]

webVitalsAttribution?: Array<typeof WEB_VITALS[number]>
webVitalsAttribution?: Array<(typeof WEB_VITALS)[number]>

turbo?: ExperimentalTurboOptions
turbotrace?: {
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/server/dev/on-demand-entry-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ const normalizeOutputPath = (dir: string) => dir.replace(/[/\\]server$/, '')

export const getEntries = (
dir: string
): NonNullable<ReturnType<typeof entriesMap['get']>> => {
): NonNullable<ReturnType<(typeof entriesMap)['get']>> => {
dir = normalizeOutputPath(dir)
const entries = entriesMap.get(dir) || {}
entriesMap.set(dir, entries)
Expand Down Expand Up @@ -303,7 +303,7 @@ class Invalidator {
}

function disposeInactiveEntries(
entries: NonNullable<ReturnType<typeof entriesMap['get']>>,
entries: NonNullable<ReturnType<(typeof entriesMap)['get']>>,
maxInactiveAge: number
) {
Object.keys(entries).forEach((entryKey) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function isInterceptionRouteAppPath(path: string): boolean {

export function extractInterceptionRouteInformation(path: string) {
let interceptingRoute: string | undefined,
marker: typeof INTERCEPTION_ROUTE_MARKERS[number] | undefined,
marker: (typeof INTERCEPTION_ROUTE_MARKERS)[number] | undefined,
interceptedRoute: string | undefined

for (const segment of path.split('/')) {
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/lib/route-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export async function makeResolver(
}

type GetEdgeFunctionInfo =
typeof DevServer['prototype']['getEdgeFunctionInfo']
(typeof DevServer)['prototype']['getEdgeFunctionInfo']
const getEdgeFunctionInfo = (
original: GetEdgeFunctionInfo
): GetEdgeFunctionInfo => {
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/web/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const HTTP_METHODS = [
* A type representing the valid HTTP methods that can be implemented by
* Next.js's Custom App Routes.
*/
export type HTTP_METHOD = typeof HTTP_METHODS[number]
export type HTTP_METHOD = (typeof HTTP_METHODS)[number]

/**
* Checks to see if the passed string is an HTTP method. Note that this is case
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/server/web/sandbox/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export async function clearModuleContext(
) {
const handleContext = (
key: string,
cache: ReturnType<typeof moduleContexts['get']>,
cache: ReturnType<(typeof moduleContexts)['get']>,
context: typeof moduleContexts | typeof pendingModuleCaches
) => {
const prev = cache?.paths.get(path)?.replace(WEBPACK_HASH_REGEX, '')
Expand Down Expand Up @@ -161,7 +161,7 @@ function getDecorateUnhandledRejection(runtime: EdgeRuntime) {

const NativeModuleMap = (() => {
const mods: Record<
`node:${typeof SUPPORTED_NATIVE_MODULES[number]}`,
`node:${(typeof SUPPORTED_NATIVE_MODULES)[number]}`,
unknown
> = {
'node:buffer': pick(BufferImplementation, [
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/shared/lib/bloom-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class BloomFilter {
return data
}

import(data: ReturnType<typeof this['export']>) {
import(data: ReturnType<(typeof this)['export']>) {
this.numItems = data.numItems
this.errorRate = data.errorRate
this.numBits = data.numBits
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/shared/lib/image-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const VALID_LOADERS = [
'custom',
] as const

export type LoaderValue = typeof VALID_LOADERS[number]
export type LoaderValue = (typeof VALID_LOADERS)[number]

export type ImageLoaderProps = {
src: string
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/shared/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export type NextWebVitalsMetric = {
} & (
| {
label: 'web-vital'
name: typeof WEB_VITALS[number]
name: (typeof WEB_VITALS)[number]
}
| {
label: 'custom'
Expand Down
Loading