Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp authored and astrobot-houston committed Dec 27, 2023
1 parent 1343674 commit a171c22
Show file tree
Hide file tree
Showing 28 changed files with 59 additions and 59 deletions.
4 changes: 2 additions & 2 deletions packages/astro/content-types.template.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ declare module 'astro:content' {
? {
collection: C;
slug: ValidContentEntrySlug<C>;
}
}
: {
collection: C;
id: keyof DataEntryMap[C];
}
}
>;
// Allow generic `string` to avoid excessive type errors in the config
// if `dev` is not running to update as you edit.
Expand Down
8 changes: 4 additions & 4 deletions packages/astro/performance/content-benchmark.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ async function benchmark({ fixtures, templates, numPosts }) {
const test = Array.isArray(flags.test)
? flags.test
: typeof flags.test === 'string'
? [flags.test]
: ['simple', 'with-astro-components', 'with-react-components'];
? [flags.test]
: ['simple', 'with-astro-components', 'with-react-components'];

const formats = Array.isArray(flags.format)
? flags.format
: typeof flags.format === 'string'
? [flags.format]
: ['md', 'mdx', 'mdoc'];
? [flags.format]
: ['md', 'mdx', 'mdoc'];

const numPosts = flags.numPosts || 1000;

Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/assets/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export async function getImage(
// Causing our generate step to think the image is used outside of the image optimization pipeline
const clonedSrc = isESMImportedImage(resolvedOptions.src)
? // @ts-expect-error - clone is a private, hidden prop
resolvedOptions.src.clone ?? resolvedOptions.src
resolvedOptions.src.clone ?? resolvedOptions.src
: resolvedOptions.src;

resolvedOptions.src = clonedSrc;
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/content/error-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const errorMap: ZodErrorMap = (baseError, ctx) => {
.map(([key, error]) =>
key === baseErrorPath
? // Avoid printing the key again if it's a base error
`> ${getTypeOrLiteralMsg(error)}`
`> ${getTypeOrLiteralMsg(error)}`
: `> ${prefix(key, getTypeOrLiteralMsg(error))}`
)
)
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/content/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ export function createGetCollection({
renderEntryImport: await getRenderEntryImport(collection, entry.slug),
});
},
}
}
: {
id: entry.id,
collection: entry.collection,
data: entry.data,
};
};
})
);
cacheEntriesByCollection.set(collection, entries);
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/content/types-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ async function writeContentFiles({
const resolvedType: 'content' | 'data' =
collection.type === 'unknown'
? // Add empty / unknown collections to the data type map by default
// This ensures `getCollection('empty-collection')` doesn't raise a type error
collectionConfig?.type ?? 'data'
// This ensures `getCollection('empty-collection')` doesn't raise a type error
collectionConfig?.type ?? 'data'
: collection.type;

switch (resolvedType) {
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/content/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,6 @@ export async function getEntrySlug({
export function getExtGlob(exts: string[]) {
return exts.length === 1
? // Wrapping {...} breaks when there is only one extension
exts[0]
exts[0]
: `{${exts.join(',')}}`;
}
4 changes: 2 additions & 2 deletions packages/astro/src/content/vite-plugin-content-imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ async function getContentEntryModule(
{ id, collection, _internal, unvalidatedData },
collectionConfig,
pluginContext
)
)
: unvalidatedData;

const contentEntryModule: ContentEntryModule = {
Expand Down Expand Up @@ -258,7 +258,7 @@ async function getDataEntryModule(
{ id, collection, _internal, unvalidatedData },
collectionConfig,
pluginContext
)
)
: unvalidatedData;

const dataEntryModule: DataEntryModule = {
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/core/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,8 @@ export class App {
const status = override?.status
? override.status
: originalResponse.status === 200
? newResponse.status
: originalResponse.status;
? newResponse.status
: originalResponse.status;

try {
// this function could throw an error...
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/build/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ function getInvalidRouteSegmentError(
route.route,
JSON.stringify(invalidParam),
JSON.stringify(received)
)
)
: `Generated path for ${route.route} is invalid.`,
hint,
});
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/core/build/plugins/plugin-css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] {
inlineConfig === 'always'
? true
: inlineConfig === 'never'
? false
: assetSize <= assetsInlineLimit;
? false
: assetSize <= assetsInlineLimit;

// there should be a single js object for each stylesheet,
// allowing the single reference to be shared and checked for duplicates
Expand Down
16 changes: 8 additions & 8 deletions packages/astro/src/core/config/tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,14 @@ export type StripEnums<T extends Record<string, any>> = {
[K in keyof T]: T[K] extends boolean
? T[K]
: T[K] extends string
? T[K]
: T[K] extends object
? T[K]
: T[K] extends Array<any>
? T[K]
: T[K] extends undefined
? undefined
: any;
? T[K]
: T[K] extends object
? T[K]
: T[K] extends Array<any>
? T[K]
: T[K] extends undefined
? undefined
: any;
};

export interface TSConfig {
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/errors/dev/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export async function getViteErrorPayload(err: ErrorWithMetadata): Promise<Astro
lang: highlighterLang,
theme: 'css-variables',
lineOptions: err.loc?.line ? [{ line: err.loc.line, classes: ['error-line'] }] : undefined,
})
})
: undefined;

if (highlightedCode) {
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/core/errors/errors-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,13 @@ ${
validRenderersCount > 0
? `There ${plural ? 'are' : 'is'} ${validRenderersCount} renderer${
plural ? 's' : ''
} configured in your \`astro.config.mjs\` file,
} configured in your \`astro.config.mjs\` file,
but ${plural ? 'none were' : 'it was not'} able to server-side render \`${componentName}\`.`
: `No valid renderer was found ${
componentExtension
? `for the \`.${componentExtension}\` file extension.`
: `for this file extension.`
}`
}`
}`,
hint: (probableRenderers: string) =>
`Did you mean to enable the ${probableRenderers} integration?\n\nSee https://docs.astro.build/en/core-concepts/framework-components/ for more information on how to install and configure integrations.`,
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/render/paginate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function generatePaginateFunction(
page:
!includesFirstPageNumber && pageNum - 1 === 1 ? undefined : String(pageNum - 1),
})
);
);
return {
params,
props: {
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/preferences/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type DotKeys<T> = T extends object
[K in keyof T]: `${Exclude<K, symbol>}${DotKeys<T[K]> extends never
? ''
: `.${DotKeys<T[K]>}`}`;
}[keyof T]
}[keyof T]
: never;

export type GetDotKey<
Expand All @@ -30,7 +30,7 @@ export interface PreferenceOptions {
type DeepPartial<T> = T extends object
? {
[P in keyof T]?: DeepPartial<T[P]>;
}
}
: T;

export type PreferenceKey = DotKeys<Preferences>;
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/runtime/client/dev-overlay/overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export class AstroDevOverlay extends HTMLElement {
this.plugins.filter((plugin) => !plugin.builtIn).length > this.customPluginsToShow
? this.getPluginTemplate(
this.plugins.find((plugin) => plugin.builtIn && plugin.id === 'astro:more')!
)
)
: ''
}
<div class="separator"></div>
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/runtime/server/jsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ async function renderElement(
? `/>`
: `>${
children == null ? '' : await renderJSX(result, prerenderElementChildren(tag, children))
}</${tag}>`
}</${tag}>`
)}`
);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/runtime/server/render/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ function stringifyChunk(
let prescriptType: PrescriptType = needsHydrationScript
? 'both'
: needsDirectiveScript
? 'directive'
: null;
? 'directive'
: null;
if (prescriptType) {
let prescripts = getPrescripts(result, prescriptType, hydration.directive);
return markHTMLString(prescripts);
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/runtime/server/transition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ class ViewTransitionStyleSheet {
direction === 'backwards'
? `[data-astro-transition=back]`
: direction === 'forwards'
? ''
: `[data-astro-transition=${direction}]`;
? ''
: `[data-astro-transition=${direction}]`;
this.addRule('modern', `${prefix}::view-transition-${image}(${name}) { ${animation} }`);
this.addRule(
'fallback',
Expand Down
10 changes: 5 additions & 5 deletions packages/astro/src/transitions/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ async function transition(
const navigationType = historyState
? 'traverse'
: options.history === 'replace'
? 'replace'
: 'push';
? 'replace'
: 'push';

if (navigationType !== 'traverse') {
updateScrollPosition({ scrollX, scrollY });
Expand Down Expand Up @@ -467,9 +467,9 @@ async function transition(
preparationEvent.sourceElement instanceof HTMLFormElement
? preparationEvent.sourceElement
: preparationEvent.sourceElement instanceof HTMLElement &&
'form' in preparationEvent.sourceElement
? (preparationEvent.sourceElement.form as HTMLFormElement)
: preparationEvent.sourceElement?.closest('form');
'form' in preparationEvent.sourceElement
? (preparationEvent.sourceElement.form as HTMLFormElement)
: preparationEvent.sourceElement?.closest('form');
// Form elements without enctype explicitly set default to application/x-www-form-urlencoded.
// In order to maintain compatibility with Astro 4.x, we need to check the value of enctype
// on the attributes property rather than accessing .enctype directly. Astro 5.x may
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/type-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ export type DeepPartial<T> = {
[P in keyof T]?: T[P] extends (infer U)[]
? DeepPartial<U>[]
: T[P] extends object | undefined
? DeepPartial<T[P]>
: T[P];
? DeepPartial<T[P]>
: T[P];
};
10 changes: 5 additions & 5 deletions packages/astro/src/vite-plugin-astro-server/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ export async function* crawlGraph(

const moduleEntriesForId = isRootFile
? // "getModulesByFile" pulls from a delayed module cache (fun implementation detail),
// So we can get up-to-date info on initial server load.
// Needed for slower CSS preprocessing like Tailwind
loader.getModulesByFile(id) ?? new Set()
// So we can get up-to-date info on initial server load.
// Needed for slower CSS preprocessing like Tailwind
loader.getModulesByFile(id) ?? new Set()
: // For non-root files, we're safe to pull from "getModuleById" based on testing.
// TODO: Find better invalidation strat to use "getModuleById" in all cases!
new Set([loader.getModuleById(id)]);
// TODO: Find better invalidation strat to use "getModuleById" in all cases!
new Set([loader.getModuleById(id)]);

// Collect all imported modules for the module(s).
for (const entry of moduleEntriesForId) {
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/preact/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function renderToStaticMarkup(
? h(StaticHtml, {
hydrate: shouldHydrate(metadata),
value: children,
})
})
: children
) as VNode<any>
);
Expand Down
4 changes: 2 additions & 2 deletions packages/integrations/vercel/src/serverless/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,9 @@ You can set functionPerRoute: false to prevent surpassing the limit.`
...(imagesConfig.remotePatterns ?? []),
..._config.image.remotePatterns,
],
}
}
: getDefaultImageConfig(_config.image),
}
}
: {}),
});

Expand Down
4 changes: 2 additions & 2 deletions packages/integrations/vercel/src/static/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ export default function vercelStatic({
...(imagesConfig.remotePatterns ?? []),
..._config.image.remotePatterns,
],
}
}
: getDefaultImageConfig(_config.image),
}
}
: {}),
});
},
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const setup = (app) => {
!isBuild
? `console.warn("[@astrojs/vue] appEntrypoint \`" + ${JSON.stringify(
appEntrypoint
)} + "\` does not export a default function. Check out https://docs.astro.build/en/guides/integrations-guide/vue/#appentrypoint.");`
)} + "\` does not export a default function. Check out https://docs.astro.build/en/guides/integrations-guide/vue/#appentrypoint.");`
: ''
}
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/cmd/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default async function build(...args) {
to: ['./dist/assets/services/vendor/squoosh'],
},
}),
]
]
: []),
],
});
Expand Down

0 comments on commit a171c22

Please sign in to comment.