From 78eeb4075d2d41213d10925d1aed3430f00c36ed Mon Sep 17 00:00:00 2001 From: bholmesdev Date: Fri, 5 Aug 2022 19:45:50 +0000 Subject: [PATCH] [ci] format --- packages/astro/src/core/config.ts | 2 +- packages/astro/src/vite-plugin-markdown/index.ts | 4 ++-- packages/astro/test/astro-markdown.test.js | 14 +++++--------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/packages/astro/src/core/config.ts b/packages/astro/src/core/config.ts index 3329dfb77..b0678de04 100644 --- a/packages/astro/src/core/config.ts +++ b/packages/astro/src/core/config.ts @@ -14,10 +14,10 @@ import { fileURLToPath, pathToFileURL } from 'url'; import * as vite from 'vite'; import { mergeConfig as mergeViteConfig } from 'vite'; import { z } from 'zod'; +import jsxRenderer from '../jsx/renderer.js'; import { LogOptions } from './logger/core.js'; import { appendForwardSlash, prependForwardSlash, trimSlashes } from './path.js'; import { arraify, isObject } from './util.js'; -import jsxRenderer from '../jsx/renderer.js'; load.use([loadTypeScript]); diff --git a/packages/astro/src/vite-plugin-markdown/index.ts b/packages/astro/src/vite-plugin-markdown/index.ts index d1f04f32d..ba622d650 100644 --- a/packages/astro/src/vite-plugin-markdown/index.ts +++ b/packages/astro/src/vite-plugin-markdown/index.ts @@ -1,13 +1,13 @@ import { renderMarkdown } from '@astrojs/markdown-remark'; -import matter from 'gray-matter'; import fs from 'fs'; +import matter from 'gray-matter'; import type { Plugin } from 'vite'; import type { AstroConfig } from '../@types/astro'; import { collectErrorMetadata } from '../core/errors.js'; import type { LogOptions } from '../core/logger/core.js'; +import { warn } from '../core/logger/core.js'; import type { PluginMetadata } from '../vite-plugin-astro/types.js'; import { getFileInfo } from '../vite-plugin-utils/index.js'; -import { warn } from '../core/logger/core.js'; interface AstroPluginOptions { config: AstroConfig; diff --git a/packages/astro/test/astro-markdown.test.js b/packages/astro/test/astro-markdown.test.js index eb1b43bcc..cf0e7a0ac 100644 --- a/packages/astro/test/astro-markdown.test.js +++ b/packages/astro/test/astro-markdown.test.js @@ -27,7 +27,6 @@ describe('Astro Markdown', () => { expect(html).to.include(''); }); - it('Exposes raw markdown content', async () => { const { raw } = JSON.parse(await fixture.readFile('/raw-content.json')); @@ -68,7 +67,6 @@ describe('Astro Markdown', () => { }); }); - it('Passes frontmatter to layout via "content" and "frontmatter" props', async () => { const html = await fixture.readFile('/with-layout/index.html'); const $ = cheerio.load(html); @@ -84,9 +82,7 @@ describe('Astro Markdown', () => { const html = await fixture.readFile('/with-layout/index.html'); const $ = cheerio.load(html); - const headingSlugs = [...$('body').find('[data-headings] > li')].map( - (el) => $(el).text() - ); + const headingSlugs = [...$('body').find('[data-headings] > li')].map((el) => $(el).text()); expect(headingSlugs.length).to.be.greaterThan(0); expect(headingSlugs).to.contain('section-1'); @@ -96,7 +92,7 @@ describe('Astro Markdown', () => { it('Exposes getHeadings() on glob imports', async () => { const { headings } = JSON.parse(await fixture.readFile('/headings-glob.json')); - const headingSlugs = headings.map(heading => heading?.slug); + const headingSlugs = headings.map((heading) => heading?.slug); expect(headingSlugs).to.contain('section-1'); expect(headingSlugs).to.contain('section-2'); @@ -106,17 +102,17 @@ describe('Astro Markdown', () => { it('Allows referencing import.meta.env in content', async () => { const html = await fixture.readFile('/vite-env-vars/index.html'); const $ = cheerio.load(html); - + // test 1: referencing an existing var name expect($('code').eq(0).text()).to.equal('import.meta.env.SITE'); expect($('li').eq(0).text()).to.equal('import.meta.env.SITE'); expect($('code').eq(3).text()).to.contain('site: import.meta.env.SITE'); - + // // test 2: referencing a non-existing var name expect($('code').eq(1).text()).to.equal('import.meta.env.TITLE'); expect($('li').eq(1).text()).to.equal('import.meta.env.TITLE'); expect($('code').eq(3).text()).to.contain('title: import.meta.env.TITLE'); - + // // test 3: referencing `import.meta.env` itself (without any var name) expect($('code').eq(2).text()).to.equal('import.meta.env'); expect($('li').eq(2).text()).to.equal('import.meta.env');