Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Jan 23, 2024
1 parent fe7a6ab commit 6149d89
Show file tree
Hide file tree
Showing 51 changed files with 102 additions and 132 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<a href="https://github.com/harlan-zw/unlighthouse" target="__blank"><img alt="GitHub stars" src="https://img.shields.io/github/stars/harlan-zw/unlighthouse?style=social"></a>
</p>


<p align="center">
Unlighthouse scans your entire site using Google Lighthouse,<br> with a modern UI, minimal config and smart sampling.
</p>
Expand Down
2 changes: 1 addition & 1 deletion docs/app/router.options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RouterConfig } from '@nuxt/schema'

function findHashPosition(hash): { el: any; behavior: ScrollBehavior; top: number } {
function findHashPosition(hash): { el: any, behavior: ScrollBehavior, top: number } {
const el = document.querySelector(hash)
// vue-router does not incorporate scroll-margin-top on its own.
if (el) {
Expand Down
2 changes: 1 addition & 1 deletion docs/components/HeaderLinks.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
const props = defineProps<{ modelValue: boolean; links: { to: string; label: string }[] }>()
const props = defineProps<{ modelValue: boolean, links: { to: string, label: string }[] }>()
const emit = defineEmits(['update:modelValue'])
const isDialogOpen = useVModel(props, 'modelValue', emit)
Expand Down
46 changes: 23 additions & 23 deletions docs/components/ShowcaseCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,31 @@ const linkAttrs = computed(() => {
</script>

<template>
<div class="showcase-card relative h-full">
<Component :is="to ? NuxtLink : 'div'" v-bind="linkAttrs" class="h-full">
<div class="group relative border hover:border-yellow-400 transition rounded-xl overflow-hidden h-full">
<div
class="h-48 relative flex items-center justify-center bg-no-repeat bg-cover border-b-2 border-gray-100/30 dark:border-gray-900/10"
style="background-image: url('/grid.png')"
>
<div class="showcase-card relative h-full">
<Component :is="to ? NuxtLink : 'div'" v-bind="linkAttrs" class="h-full">
<div class="group relative border hover:border-yellow-400 transition rounded-xl overflow-hidden h-full">
<div
class="blur-overlay w-full h-full absolute pointer-events-none"
/>
<div class="z-10 text-yellow-200 group-hover:text-[1.25rem] w-full h-full flex items-center justify-center group-hover:text-yellow-500 transition-all relative transform group-hover:drop-shadow-xl group-hover:scale-110">
<slot />
class="h-48 relative flex items-center justify-center bg-no-repeat bg-cover border-b-2 border-gray-100/30 dark:border-gray-900/10"
style="background-image: url('/grid.png')"
>
<div
class="blur-overlay w-full h-full absolute pointer-events-none"
/>
<div class="z-10 text-yellow-200 group-hover:text-[1.25rem] w-full h-full flex items-center justify-center group-hover:text-yellow-500 transition-all relative transform group-hover:drop-shadow-xl group-hover:scale-110">
<slot />
</div>
<slot name="teleport" />
</div>
<slot name="teleport" />
</div>

<div class="p-4">
<h3 class="font-semibold mb-1">
{{ label }}
</h3>
<p class="text-sm mt-1 text-gray-500">
{{ description }}
</p>
<div class="p-4">
<h3 class="font-semibold mb-1">
{{ label }}
</h3>
<p class="text-sm mt-1 text-gray-500">
{{ description }}
</p>
</div>
</div>
</div>
</Component>
</div>
</Component>
</div>
</template>
2 changes: 1 addition & 1 deletion docs/components/docs/DocsSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const breakpoints = useBreakpoints({ mobile: 640 })
const isXs = breakpoints.smaller('mobile')
const commandPaletteRef = ref<HTMLElement & { query: Ref<string>; results: { item: Command }[] }>()
const commandPaletteRef = ref<HTMLElement & { query: Ref<string>, results: { item: Command }[] }>()
const { data: files } = await useLazyAsyncData('search', () => queryContent().where({ _type: 'markdown' }).find(), { default: () => [] })
Expand Down
3 changes: 1 addition & 2 deletions docs/content/1.guide/1.getting-started/0.unlighthouse-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ If you're using Windows Subsystem for Linux and run into issues, see [Solving Co

## Integrations and CI

See the [integrations](/guide/getting-started/integrations) page for more information.

See the [integrations](/guide/getting-started/integrations) page for more information.

## Getting Help

Expand Down
1 change: 0 additions & 1 deletion docs/content/1.guide/1.getting-started/1.integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ description: Unlighthouse can be integrated into your existing build tools and f
| [CLI](/integrations/cli) | Scan a production site such as [unlighthouse.dev](https://unlighthouse.dev).<br><br> You can manually provide a project mapping for [routes definitions](/guide/guides/route-definitions). |
| [CI](/integrations/ci) | Run scans on sites based on automation events, i.e releasing and make [assertions on scores](/integrations/ci#assertions).<br><br> Can also be used to generate report sites such as [inspect.unlighthouse.dev](https://inspect.unlighthouse.dev/). |


## Build tools / Frameworks

::u-alert{type="warning"}
Expand Down
3 changes: 1 addition & 2 deletions docs/content/1.guide/1.getting-started/how-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ hooks.hookOnce('visited-client', () => {
Discovery of the [route definitions](/api/glossary/#route-definition) is attempted. A virtual router for the route
definitions is created.

Attempt to read the robots.txt to disocver the sitemap and excluded routes.
Attempt to read the robots.txt to disocver the sitemap and excluded routes.

With the sitemap.xml, we collect the list of URLs to work with, if no sitemap is discovered, the home page will be
scanned.
Expand All @@ -75,4 +75,3 @@ Broadcasting setup on worker events.

The [unrouted](https://github.com/harlan-zw/unrouted) API instance routes requests to the worker to perform actions.
Static files such as the full-page screenshot and lighthouse HTML report are served.

3 changes: 1 addition & 2 deletions docs/content/1.guide/guides/0.config.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default defineConfig({
})
```

### Global dependency
### Global dependency

You can still provide a configuration file when using Unlighthouse globally, however, you won't be able to make use of
the types or `defineConfig` function, instead you'll need to export a plain object.
Expand All @@ -48,7 +48,6 @@ export default {

See the list of config options in the [Config Reference](/api/config).


## Example

```ts unlighthouse.config.ts
Expand Down
6 changes: 3 additions & 3 deletions docs/content/1.guide/guides/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Authentication
description: How to authenticate your site before scanning.
---

Unlighthouse is built to support scanning sites that require authentication.
Unlighthouse is built to support scanning sites that require authentication.

## Basic Authentication

Expand Down Expand Up @@ -123,7 +123,7 @@ export default {
## Programmatic Usage

You can also use control Puppeteer programmatically before the page is scanned using a config file.
This is
This is
more experimental, and you may run into issues.

You can see an example here:
Expand Down Expand Up @@ -152,7 +152,7 @@ export default {

If you're having trouble authenticating,
you can use the `debug: true` and `headless: false`,
flags to see what's happening.
flags to see what's happening.

```bash
// unlighthouse.config.ts
Expand Down
2 changes: 1 addition & 1 deletion docs/content/1.guide/guides/common-errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This can be from a number of reasons:

**Windows and WSL Solution**

- Install Puppeteer on WSL following the [documentation](https://pptr.dev/troubleshooting#running-puppeteer-on-wsl-windows-subsystem-for-linux).
- Install Puppeteer on WSL following the [documentation](https://pptr.dev/troubleshooting#running-puppeteer-on-wsl-windows-subsystem-for-linux).
- Install Chrome in WSL following the [documentation](https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps#install-google-chrome-for-linux).

**Other Environments**
Expand Down
3 changes: 1 addition & 2 deletions docs/content/1.guide/guides/device.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: How to change the device used for scanning.

Unlighthouse uses the [lighthouse node module](https://github.com/GoogleChrome/lighthouse) to perform scans.

By default, Unlighthouse will uses the default lighthouse configuration, which emulates a mobile device. Unlighthouse
By default, Unlighthouse will uses the default lighthouse configuration, which emulates a mobile device. Unlighthouse
does _not throttle_ by default.

The device dimensions details are:
Expand All @@ -28,7 +28,6 @@ export default {
}
```


To change it to mobile (default):

```ts
Expand Down
1 change: 0 additions & 1 deletion docs/content/1.guide/guides/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,3 @@ export default {

Please see the following community repos:
- [indykoning—Unlighthouse Docker](https://github.com/indykoning/unlighthouse-docker)

2 changes: 1 addition & 1 deletion docs/content/1.guide/guides/dynamic-sampling.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ When dynamic sampling is enabled, it will group paths into chunks based on their
For example, let's imagine we have a blog on our site and there are hundreds of blog posts. Scanning every blog post will
take a long time and may even break Unlighthouse.

The path structure is `/blog/{post}`.
The path structure is `/blog/{post}`.

Unlighthouse will turn this path structure into groups based on the `/blog` prefix. By default, it will sample
5 paths starting with this prefix.
Expand Down
6 changes: 2 additions & 4 deletions docs/content/1.guide/guides/generating-static-reports.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Generate static reports for your site.

When you run Unlighthouse using `npx unlighthouse`, you're using the CLI mode. This mode generates and runs the interactive client.

This is useful for quickly scanning your site and finding issues.
This is useful for quickly scanning your site and finding issues.

However, you want to set up some automation around these reports. Creating reports that can be accessed through a static host.

Expand Down Expand Up @@ -61,7 +61,7 @@ wrangler init
You can then run the following command to generate the static report and upload it to CloudFlare Pages.

```bash
unlighthouse-ci --site www.example.com --build-static && wrangler pages publish .unlighthouse
unlighthouse-ci --site www.example.com --build-static && wrangler pages publish .unlighthouse
```

#### GitHub Actions & Netlify Example
Expand Down Expand Up @@ -131,7 +131,6 @@ URL,Score,Performance,Accessibility,Best Practices,SEO,Largest Contentful Paint,
"/talks",98,90,100,100,100,864.86,0,390.93,427.94,1,1,1,1,1,1,1,1,1,1
```


## JSON Reports

You can generate a JSON report by providing the `--reporter json` or `--reporter jsonExpanded` flag.
Expand Down Expand Up @@ -228,4 +227,3 @@ This will generate a report like the following (`json` sample):
}
]
```

5 changes: 2 additions & 3 deletions docs/content/1.guide/guides/route-definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ description: Route definitions are an optional feature of Unlighthouse.

Providing route definitions will give you more intelligent sampling and file hints.

When you start Unlighthouse, it will try and map your page files to [route definitions](/api/glossary/#route-definition).
When you start Unlighthouse, it will try and map your page files to [route definitions](/api/glossary/#route-definition).

Using Unlighthouse with the provided integrations, the route definitions should be discovered on their own.
Using Unlighthouse with the provided integrations, the route definitions should be discovered on their own.
If you have a custom setup or are using the CLI, you will need to manually set up the discovery.

## Pages directory
Expand All @@ -26,7 +26,6 @@ export default {
}
```


## Custom sampling

When you have URL patterns which don't use URL segments or the mapping is failing, it can be useful to map the sampling
Expand Down
10 changes: 4 additions & 6 deletions docs/content/1.guide/guides/url-discovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ title: Site Crawler
description: How Unlighthouse discovers URLs to scan.
---


Unlighthouse comes with multiple methods for URL discovery in the form of crawling.

1. Add the specified `site` from `--site` or config
2. Manually providing URLs via the `--urls` flag or `urls` on the provider.
3. `robotsTxt` - Reading robots.txt, if it exists. Provides sitemap URLs and disallowed paths.
4. `sitemap` - Reading sitemap.xml, if it exists
5. `crawler` - Inspecting internal links
4. `sitemap` - Reading sitemap.xml, if it exists
5. `crawler` - Inspecting internal links
6. Using provided static [route definitions](/api/glossary/#route-definition)

## Robots.txt
Expand All @@ -19,7 +18,7 @@ When a robots.txt is found, it will attempt to read the sitemap and disallowed p

### Disabling robots

You may not want to use the robots.txt in all occasions. For example if you want to scan
You may not want to use the robots.txt in all occasions. For example if you want to scan
URLs which are disallowed.

```ts
Expand All @@ -31,7 +30,6 @@ URLs which are disallowed.
}
```


## Sitemap.xml

By default, the sitemap config will be read from your `/robots.txt`. Otherwise, it will fall back to using `/sitemap.xml`.
Expand Down Expand Up @@ -68,7 +66,7 @@ export default {

## Crawler

When enabled, the crawler will inspect the HTML payload of a page and extract internal links.
When enabled, the crawler will inspect the HTML payload of a page and extract internal links.
These internal links will be queued up and scanned if they haven't already been scanned.

## Disable crawling
Expand Down
1 change: 0 additions & 1 deletion docs/content/1.guide/recipes/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ export default {
}
}
```

3 changes: 0 additions & 3 deletions docs/content/1.guide/recipes/improving-accuracy.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,3 @@ export default {
}
}
```



3 changes: 0 additions & 3 deletions docs/content/1.guide/recipes/large-sites.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,3 @@ export default {
}
}
```



2 changes: 0 additions & 2 deletions docs/content/1.guide/recipes/spa.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@ export default {
}
}
```


1 change: 0 additions & 1 deletion docs/content/2.integrations/0.cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ See the [Configuration](#configuration) section for more details and the guides.
| `-d, --debug` | Debug. Enable debugging in the logger. |
| `-h, --help` | Display available CLI options |


### Config File

If you want to configure Unlighthouse, you can create a `unlighthouse.config.ts` file in your cwd.
Expand Down
2 changes: 0 additions & 2 deletions docs/content/2.integrations/1.ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ Configuring the CLI can be done either through the CI arguments or through a con
| `-d, --debug` | Debug. Enable debugging in the logger. |
| `-h, --help` | Display available CLI options |


### Config File

If you want to configure Unlighthouse, you can create a `unlighthouse.config.ts` file in your cwd.
Expand All @@ -140,7 +139,6 @@ export default {

See the [Configuration](#configuration) section for more details and the guides.


## Github Actions & Netlify Example

This example is for Github Actions and deploys a static client build to Netlify.
Expand Down
1 change: 0 additions & 1 deletion docs/content/2.integrations/3.nuxt.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ Type support can be added by adding the `@unlighthouse/nuxt` module to your `plu
You can either configure Unlighthouse via the `unlighthouse` key in your Nuxt config, or you can provide a `unlighthouse.config.ts` file
in the root directory.


### Example

```js nuxt.config.js
Expand Down
2 changes: 0 additions & 2 deletions docs/content/2.integrations/4.vite.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ To begin using Unlighthouse, you'll need to add the plugin to `plugins`.

When you run your Vite app, it will give you the URL of client, only once you visit the client will Unlighthouse start.


```ts vite.config.ts
import Unlighthouse from '@unlighthouse/vite'

Expand Down Expand Up @@ -82,7 +81,6 @@ export default defineConfig({
})
```


## Configuration

You can either configure Unlighthouse via the plugin, or you can provide a [config file](/guide/guides/config) file
Expand Down
1 change: 0 additions & 1 deletion docs/content/2.integrations/webpack.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Read more about [integration deprecations](/integration-deprecations).
Using the Unlighthouse webpack plugin allows you to close the feedback loop in fixing your Google Lighthouse issues in
your development site.


## Install

::code-group
Expand Down
2 changes: 1 addition & 1 deletion docs/content/3.api/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Unlighthouse provides intelligent sampling which relies on knowing which URLs ma
To achieve this, it needs to create its own router with your files to test any URL that comes through.

Different integrations will have different requirements from the router.
For example, different frameworks will resolve files that contain substitutes
For example, different frameworks will resolve files that contain substitutes
(for example `/posts/[post].vue` may work in one framework but not another).

```ts
Expand Down
Loading

0 comments on commit 6149d89

Please sign in to comment.