Skip to content

Commit

Permalink
update formatter config (#11640)
Browse files Browse the repository at this point in the history
* update formatter config

* format

---------

Co-authored-by: Erika <[email protected]>
  • Loading branch information
itsMapleLeaf and Princesseuh authored Aug 8, 2024
1 parent 85de47c commit 72c7ae9
Show file tree
Hide file tree
Showing 492 changed files with 1,863 additions and 1,848 deletions.
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"linter": { "enabled": false },
"javascript": {
"formatter": {
"trailingCommas": "es5",
"trailingCommas": "all",
"quoteStyle": "single",
"semicolons": "always"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/blog/src/pages/blog/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getCollection } from 'astro:content';
import FormattedDate from '../../components/FormattedDate.astro';
const posts = (await getCollection('blog')).sort(
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
);
---

Expand Down
2 changes: 1 addition & 1 deletion examples/portfolio/src/pages/work.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Hero from '../components/Hero.astro';
import Grid from '../components/Grid.astro';
const projects = (await getCollection('work')).sort(
(a, b) => b.data.publishDate.valueOf() - a.data.publishDate.valueOf()
(a, b) => b.data.publishDate.valueOf() - a.data.publishDate.valueOf(),
);
---

Expand Down
2 changes: 1 addition & 1 deletion packages/astro-prism/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ runHighlighterWithAstro(
<div>{helloAstro}</div>
`,
'astro'
'astro',
);
```
8 changes: 4 additions & 4 deletions packages/astro-prism/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function addAstro(Prism: typeof import('prismjs')) {
scriptLang = 'javascript';
// eslint-disable-next-line no-console
console.warn(
'Prism TypeScript language not loaded, Astro scripts will be treated as JavaScript.'
'Prism TypeScript language not loaded, Astro scripts will be treated as JavaScript.',
);
}

Expand Down Expand Up @@ -41,7 +41,7 @@ export function addAstro(Prism: typeof import('prismjs')) {

(Prism.languages.astro as any).tag.pattern = re(
/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/
.source
.source,
);

(Prism.languages.astro as any).tag.inside['tag'].pattern = /^<\/?[^\s>/]*/;
Expand All @@ -60,7 +60,7 @@ export function addAstro(Prism: typeof import('prismjs')) {
inside: Prism.languages.astro,
},
},
(Prism.languages.astro as any).tag
(Prism.languages.astro as any).tag,
);

Prism.languages.insertBefore(
Expand All @@ -80,7 +80,7 @@ export function addAstro(Prism: typeof import('prismjs')) {
alias: `language-${scriptLang}`,
},
},
(Prism.languages.astro as any).tag
(Prism.languages.astro as any).tag,
);

// The following will handle plain text inside tags
Expand Down
18 changes: 9 additions & 9 deletions packages/astro-rss/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ const rssOptionsValidator = z.object({
// eslint-disable-next-line
console.warn(
yellow(
'[RSS] Passing a glob result directly has been deprecated. Please migrate to the `pagesGlobToRssItems()` helper: https://docs.astro.build/en/guides/rss/'
)
'[RSS] Passing a glob result directly has been deprecated. Please migrate to the `pagesGlobToRssItems()` helper: https://docs.astro.build/en/guides/rss/',
),
);
return pagesGlobToRssItems(items);
}
Expand Down Expand Up @@ -123,7 +123,7 @@ async function validateRssOptions(rssOptions: RSSOptions) {

return message;
}),
].join('\n')
].join('\n'),
);
throw formattedError;
}
Expand All @@ -134,7 +134,7 @@ export function pagesGlobToRssItems(items: GlobResult): Promise<ValidatedRSSFeed
const { url, frontmatter } = await getInfo();
if (url === undefined || url === null) {
throw new Error(
`[RSS] You can only glob entries within 'src/pages/' when passing import.meta.glob() directly. Consider mapping the result to an array of RSSFeedItems. See the RSS docs for usage examples: https://docs.astro.build/en/guides/rss/#2-list-of-rss-feed-objects`
`[RSS] You can only glob entries within 'src/pages/' when passing import.meta.glob() directly. Consider mapping the result to an array of RSSFeedItems. See the RSS docs for usage examples: https://docs.astro.build/en/guides/rss/#2-list-of-rss-feed-objects`,
);
}
const parsedResult = rssSchema
Expand All @@ -151,11 +151,11 @@ export function pagesGlobToRssItems(items: GlobResult): Promise<ValidatedRSSFeed
[
`[RSS] ${filePath} has invalid or missing frontmatter.\nFix the following properties:`,
...parsedResult.error.errors.map((zodError) => zodError.message),
].join('\n')
].join('\n'),
);
(formattedError as any).file = filePath;
throw formattedError;
})
}),
);
}

Expand Down Expand Up @@ -207,7 +207,7 @@ async function generateRSS(rssOptions: ValidatedRSSOptions): Promise<string> {
if (typeof rssOptions.customData === 'string')
Object.assign(
root.rss.channel,
parser.parse(`<channel>${rssOptions.customData}</channel>`).channel
parser.parse(`<channel>${rssOptions.customData}</channel>`).channel,
);
// items
root.rss.channel.item = items.map((result) => {
Expand Down Expand Up @@ -250,15 +250,15 @@ async function generateRSS(rssOptions: ValidatedRSSOptions): Promise<string> {
}
if (result.source) {
item.source = parser.parse(
`<source url="${result.source.url}">${result.source.title}</source>`
`<source url="${result.source.url}">${result.source.title}</source>`,
).source;
}
if (result.enclosure) {
const enclosureURL = isValidURL(result.enclosure.url)
? result.enclosure.url
: createCanonicalURL(result.enclosure.url, rssOptions.trailingSlash, site);
item.enclosure = parser.parse(
`<enclosure url="${enclosureURL}" length="${result.enclosure.length}" type="${result.enclosure.type}"/>`
`<enclosure url="${enclosureURL}" length="${result.enclosure.length}" type="${result.enclosure.type}"/>`,
).enclosure;
}
return item;
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-rss/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { RSSOptions } from './index.js';
export function createCanonicalURL(
url: string,
trailingSlash?: RSSOptions['trailingSlash'],
base?: string
base?: string,
): string {
let pathname = url.replace(/\/index.html$/, ''); // index.html is not canonical
if (!getUrlExtension(url)) {
Expand Down
14 changes: 7 additions & 7 deletions packages/astro-rss/test/pagesGlobToRssItems.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('pagesGlobToRssItems', () => {
pubDate: phpFeedItem.pubDate,
description: phpFeedItem.description,
},
})
}),
),
'./posts/nested/web1.md': () =>
new Promise((resolve) =>
Expand All @@ -27,7 +27,7 @@ describe('pagesGlobToRssItems', () => {
pubDate: web1FeedItem.pubDate,
description: web1FeedItem.description,
},
})
}),
),
};

Expand All @@ -49,7 +49,7 @@ describe('pagesGlobToRssItems', () => {

assert.deepEqual(
items.sort((a, b) => a.pubDate - b.pubDate),
expected
expected,
);
});

Expand All @@ -63,7 +63,7 @@ describe('pagesGlobToRssItems', () => {
pubDate: phpFeedItem.pubDate,
description: phpFeedItem.description,
},
})
}),
),
};
return assert.rejects(pagesGlobToRssItems(globResult));
Expand All @@ -80,7 +80,7 @@ describe('pagesGlobToRssItems', () => {
pubDate: phpFeedItem.pubDate,
description: undefined,
},
})
}),
),
};
return assert.rejects(pagesGlobToRssItems(globResult));
Expand All @@ -97,7 +97,7 @@ describe('pagesGlobToRssItems', () => {
pubDate: phpFeedItem.pubDate,
description: phpFeedItem.description,
},
})
}),
),
};
return assert.doesNotReject(pagesGlobToRssItems(globResult));
Expand All @@ -114,7 +114,7 @@ describe('pagesGlobToRssItems', () => {
pubDate: phpFeedItem.pubDate,
description: undefined,
},
})
}),
),
};
return assert.doesNotReject(pagesGlobToRssItems(globResult));
Expand Down
4 changes: 2 additions & 2 deletions packages/astro-rss/test/rss.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ describe('getRssString', () => {
pubDate: phpFeedItem.pubDate,
description: phpFeedItem.description,
},
})
}),
),
'./posts/nested/web1.md': () =>
new Promise((resolve) =>
Expand All @@ -202,7 +202,7 @@ describe('getRssString', () => {
pubDate: web1FeedItem.pubDate,
description: web1FeedItem.description,
},
})
}),
),
};

Expand Down
12 changes: 6 additions & 6 deletions packages/astro/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@
export function Like({ postId }: { postId: string }) {
const [state, action, pending] = useActionState(
experimental_withState(actions.like),
0 // initial likes
0, // initial likes
);

return (
Expand Down Expand Up @@ -1341,7 +1341,7 @@
{
site: 'https://example.com',
trailingSlash: 'never',
}
},
);
```

Expand Down Expand Up @@ -1714,7 +1714,7 @@
middleware({
redirectToDefaultLocale: false,
prefixDefaultLocale: true,
})
}),
);
```

Expand Down Expand Up @@ -1985,7 +1985,7 @@
detail: {
level: 'warning',
},
})
}),
);
```

Expand Down Expand Up @@ -6675,7 +6675,7 @@
const hydrate = await load();
await hydrate();
},
{ once: true }
{ once: true },
);
};

Expand Down Expand Up @@ -8970,7 +8970,7 @@
{ darkMode: true },
{
expires: '1 month',
}
},
);

const prefs = Astro.cookies.get<Prefs>('prefs').json();
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/astro.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Please upgrade Node.js to a supported version: "${engines}"\n`);
}
}
console.log(
`${ci.name} CI Environment Detected!\nAdditional steps may be needed to set your Node.js version:`
`${ci.name} CI Environment Detected!\nAdditional steps may be needed to set your Node.js version:`,
);
console.log(`Documentation: https://docs.astro.build/en/guides/deploy/`);
if (CI_INSTRUCTIONS[platform]) {
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ declare module 'astro:assets' {
* This is functionally equivalent to using the `<Image />` component, as the component calls this function internally.
*/
getImage: (
options: import('./dist/assets/types.js').UnresolvedImageTransform
options: import('./dist/assets/types.js').UnresolvedImageTransform,
) => Promise<import('./dist/assets/types.js').GetImageResult>;
imageConfig: import('./dist/@types/astro.js').AstroConfig['image'];
getConfiguredImageService: typeof import('./dist/assets/index.js').getConfiguredImageService;
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/components/Picture.astro
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ const optimizedImages: GetImageResult[] = await Promise.all(
format: format,
widths: props.widths,
densities: props.densities,
})
)
}),
),
);
let resultFallbackFormat = fallbackFormat ?? defaultFallbackFormat;
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/components/ViewTransitions.astro
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const { fallback = 'animate' } = Astro.props;
if (supportsViewTransitions || getFallback() !== 'none') {
if (import.meta.env.DEV && window.matchMedia('(prefers-reduced-motion)').matches) {
console.warn(
`[transitions]: all view transition animations, including fallback animation, are disabled as this device has the prefer-reduced-motion setting enabled.`
`[transitions]: all view transition animations, including fallback animation, are disabled as this device has the prefer-reduced-motion setting enabled.`,
);
}
document.addEventListener('click', (ev) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function defineConfig(config: AstroUserConfig): AstroUserConfig;
*/
export function getViteConfig(
config: ViteUserConfig,
inlineAstroConfig?: AstroInlineConfig
inlineAstroConfig?: AstroInlineConfig,
): ViteUserConfigFn;

/**
Expand Down
Loading

0 comments on commit 72c7ae9

Please sign in to comment.