Skip to content

Commit a27980b

Browse files
authoredJul 17, 2023
feat!: move to prettier v3 (#17)
* feat!: move to prettier 3 * chore: take chores off the changelog
1 parent 8a5e30b commit a27980b

36 files changed

+352
-146
lines changed
 

‎.eslintignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dist
2+
pnpm-lock.yaml
3+
cache
4+
temp
5+
fixtures
6+
.github

‎.github/codeql-config.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
paths-ignore:
2+
- node_modules
3+
- dist
4+
- lib
5+
- fixtures

‎.github/renovate.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
33
"extends": ["config:base", "group:allNonMajor", ":semanticCommitTypeAll(chore)"],
4-
"ignorePaths": [
5-
"**/node_modules/**",
6-
"**/bower_components/**",
7-
"**/fixtures/**"
8-
],
4+
"ignorePaths": ["**/node_modules/**", "**/bower_components/**", "**/fixtures/**"],
95
"meteor": {
106
"enabled": false
117
},

‎.github/workflows/codeql.yml

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: 'CodeQL'
13+
14+
on:
15+
# push:
16+
# branches: ['main']
17+
# pull_request:
18+
# # The branches below must be a subset of the branches above
19+
# branches: ['main']
20+
schedule:
21+
- cron: '26 3 * * 1'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
# Runner size impacts CodeQL analysis time. To learn more, please see:
27+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
28+
# - https://gh.io/supported-runners-and-hardware-resources
29+
# - https://gh.io/using-larger-runners
30+
# Consider using larger runners for possible analysis time improvements.
31+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
32+
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
33+
permissions:
34+
actions: read
35+
contents: read
36+
security-events: write
37+
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
language: ['javascript']
42+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
43+
# Use only 'java' to analyze code written in Java, Kotlin or both
44+
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
45+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
46+
47+
steps:
48+
- name: Checkout repository
49+
uses: actions/checkout@v3
50+
51+
# Initializes the CodeQL tools for scanning.
52+
- name: Initialize CodeQL
53+
uses: github/codeql-action/init@v2
54+
with:
55+
config-file: ./.github/codeql-config.yml
56+
languages: ${{ matrix.language }}
57+
# If you wish to specify custom queries, you can do so here or in a config file.
58+
# By default, queries listed here will override any specified in a config file.
59+
# Prefix the list here with "+" to use these queries and those in the config file.
60+
61+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
62+
# queries: security-extended,security-and-quality
63+
64+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
65+
# If this step fails, then you should remove it and run the build manually (see below)
66+
- name: Autobuild
67+
uses: github/codeql-action/autobuild@v2
68+
69+
# ℹ️ Command-line programs to run using the OS shell.
70+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
71+
72+
# If the Autobuild fails above, remove it and uncomment the following three lines.
73+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
74+
75+
# - run: |
76+
# echo "Run, Build Application using script"
77+
# ./location_of_script_within_repo/buildscript.sh
78+
79+
- name: Perform CodeQL Analysis
80+
uses: github/codeql-action/analyze@v2
81+
with:
82+
category: '/language:${{matrix.language}}'

‎.github/workflows/lint-action.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: Lint
3+
4+
on:
5+
# Trigger the workflow on push or pull request,
6+
# but only for the main branch
7+
push:
8+
branches:
9+
- main
10+
pull_request:
11+
branches:
12+
- main
13+
14+
permissions:
15+
checks: write
16+
contents: read
17+
packages: read
18+
statuses: write
19+
20+
jobs:
21+
run-linters:
22+
name: Run linters
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
- uses: pnpm/action-setup@v2
28+
with:
29+
version: 8
30+
- uses: actions/setup-node@v3
31+
with:
32+
node-version: 18
33+
cache: pnpm
34+
- name: Install dependencies
35+
run: pnpm install
36+
- name: Run linters
37+
uses: wearerequired/lint-action@v2
38+
with:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
eslint: true
41+
eslint_extensions: js,ts
42+
prettier: true
43+
dotnet_format: false

‎.github/workflows/lint-pr-title.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: 'Lint PR Title'
2+
on:
3+
pull_request_target:
4+
types:
5+
- opened
6+
- edited
7+
8+
jobs:
9+
main:
10+
permissions:
11+
contents: read
12+
pull-requests: read
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: release-please-plus/action-lint-pr-title@v1
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.github/workflows/publish-npm.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
on:
2+
workflow_dispatch:
3+
name: publish to npm
4+
jobs:
5+
publish:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v3
9+
- uses: pnpm/action-setup@v2
10+
with:
11+
version: 8
12+
- uses: actions/setup-node@v3
13+
with:
14+
registry-url: 'https://registry.npmjs.org'
15+
node-version: 18
16+
cache: pnpm
17+
- run: pnpm install
18+
- run: pnpm -r publish --access public
19+
env:
20+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

‎.github/workflows/release.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
name: release
6+
jobs:
7+
release:
8+
name: release-please-plus
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write # to be able to publish a GitHub release
12+
issues: write # to be able to comment on released issues
13+
pull-requests: write # to be able to comment on released pull requests
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: pnpm/action-setup@v2
17+
with:
18+
version: 8
19+
- uses: actions/setup-node@v3
20+
with:
21+
registry-url: 'https://registry.npmjs.org'
22+
node-version: 18
23+
cache: pnpm
24+
# Now that we know the build runs, create a release PR if needed.
25+
- uses: release-please-plus/action@main
26+
id: release
27+
with:
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
# command: manifest
30+
# bootstrap-sha: 6ff71bc6933cad82b14ea9e363a3b51eb39fd857
31+
release-type: node
32+
plugins: sentence-case
33+
changelog-types: >
34+
[
35+
{ "type": "feat", "section": "✨ Features" },
36+
{ "type": "feature", "section": "✨ Features" },
37+
{ "type": "perf", "section": "⚡️Performance Improvements" },
38+
{ "type": "fix", "section": "🐛 Bug Fixes" },
39+
{ "type": "revert", "section": "⏪️ Reverts" },
40+
{ "type": "docs", "section": "📝 Documentation" },
41+
{ "type": "style", "section": "🎨 Styles" },
42+
{ "type": "chore", "section": "🏡 Miscellaneous Chores", "hidden": true },
43+
{ "type": "refactor", "section": "♻️ Code Refactoring", "hidden": true },
44+
{ "type": "test", "section": "✅ Tests", "hidden": true },
45+
{ "type": "build", "section": "📦️ Build System", "hidden": true },
46+
{ "type": "ci", "section": "🤖 Continuous Integration", "hidden": true }
47+
]
48+
extra-files: |
49+
{ "type": "xml", "path": "src/Test.csproj", "xpath": "//project/propertygroup/version" }
50+
{ "type": "xml", "path": "src/Directory.Build.props", "xpath": "//project/propertygroup/version" }
51+
- name: Publish to NPM
52+
if: ${{ steps.release.outputs.release_created }}
53+
run: |
54+
pnpm install
55+
pnpm -r publish --access public
56+
env:
57+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

‎.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ dist
22
pnpm-lock.yaml
33
cache
44
temp
5+
CHANGELOG.md

‎.prettierrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ const baseConfig = require('@jcamp/eslint-config/.prettierrc.js')
22

33
module.exports = {
44
...baseConfig,
5-
/* make any changes here*/
5+
/* make any changes here */
66
}

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const baseConfig = require('@jcamp/eslint-config/.prettierrc.js')
3939

4040
module.exports = {
4141
...baseConfig,
42-
/* make any changes here*/
42+
/* make any changes here */
4343
singleAttributePerLine: false,
4444
}
4545
```

‎fixtures/vitesse/cypress/e2e/basic.spec.ts

+7-20
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,20 @@ context('Basic', () => {
44
})
55

66
it('basic nav', () => {
7-
cy.url()
8-
.should('eq', 'http://localhost:3333/')
7+
cy.url().should('eq', 'http://localhost:3333/')
98

10-
cy.contains('[Home Layout]')
11-
.should('exist')
9+
cy.contains('[Home Layout]').should('exist')
1210

13-
cy.get('#input')
14-
.type('Vitesse{Enter}')
15-
.url()
16-
.should('eq', 'http://localhost:3333/hi/Vitesse')
11+
cy.get('#input').type('Vitesse{Enter}').url().should('eq', 'http://localhost:3333/hi/Vitesse')
1712

18-
cy.contains('[Default Layout]')
19-
.should('exist')
13+
cy.contains('[Default Layout]').should('exist')
2014

21-
cy.get('[btn]')
22-
.click()
23-
.url()
24-
.should('eq', 'http://localhost:3333/')
15+
cy.get('[btn]').click().url().should('eq', 'http://localhost:3333/')
2516
})
2617

2718
it('markdown', () => {
28-
cy.get('[title="About"]')
29-
.click()
30-
.url()
31-
.should('eq', 'http://localhost:3333/about')
19+
cy.get('[title="About"]').click().url().should('eq', 'http://localhost:3333/about')
3220

33-
cy.get('.shiki')
34-
.should('exist')
21+
cy.get('.shiki').should('exist')
3522
})
3623
})

‎fixtures/vitesse/index.html

+20-19
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8">
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6-
<link rel="apple-touch-icon" href="/pwa-192x192.png">
7-
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#00aba9">
8-
<meta name="msapplication-TileColor" content="#00aba9">
9-
<script>
10-
(function () {
11-
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
12-
const setting = localStorage.getItem('vueuse-color-scheme') || 'auto'
13-
if (setting === 'dark' || (prefersDark && setting !== 'light'))
14-
document.documentElement.classList.toggle('dark', true)
15-
})()
16-
</script>
17-
</head>
18-
<body class="font-sans">
19-
<div id="app"></div>
20-
<script type="module" src="/src/main.ts"></script>
21-
</body>
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<link rel="apple-touch-icon" href="/pwa-192x192.png" />
7+
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#00aba9" />
8+
<meta name="msapplication-TileColor" content="#00aba9" />
9+
<script>
10+
;(function () {
11+
const prefersDark =
12+
window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
13+
const setting = localStorage.getItem('vueuse-color-scheme') || 'auto'
14+
if (setting === 'dark' || (prefersDark && setting !== 'light'))
15+
document.documentElement.classList.toggle('dark', true)
16+
})()
17+
</script>
18+
</head>
19+
<body class="font-sans">
20+
<div id="app"></div>
21+
<script type="module" src="/src/main.ts"></script>
22+
</body>
2223
</html>

‎fixtures/vitesse/src/App.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ useHead({
88
{ name: 'description', content: 'Opinionated Vite Starter Template' },
99
{
1010
name: 'theme-color',
11-
content: computed(() => isDark.value ? '#00aba9' : '#ffffff'),
11+
content: computed(() => (isDark.value ? '#00aba9' : '#ffffff')),
1212
},
1313
],
1414
link: [
1515
{
1616
rel: 'icon',
1717
type: 'image/svg+xml',
18-
href: computed(() => preferredDark.value ? '/favicon-dark.svg' : '/favicon.svg'),
18+
href: computed(() => (preferredDark.value ? '/favicon-dark.svg' : '/favicon.svg')),
1919
},
2020
],
2121
})
2222
</script>
2323

2424
<template>
25-
<RouterView />
25+
<RouterView class="mx-5 py-5" />
2626
</template>

‎fixtures/vitesse/src/auto-imports.d.ts

+24-8
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,9 @@ declare module '@vue/runtime-core' {
296296
readonly createGlobalState: UnwrapRef<typeof import('@vueuse/core')['createGlobalState']>
297297
readonly createInjectionState: UnwrapRef<typeof import('@vueuse/core')['createInjectionState']>
298298
readonly createReactiveFn: UnwrapRef<typeof import('@vueuse/core')['createReactiveFn']>
299-
readonly createSharedComposable: UnwrapRef<typeof import('@vueuse/core')['createSharedComposable']>
299+
readonly createSharedComposable: UnwrapRef<
300+
typeof import('@vueuse/core')['createSharedComposable']
301+
>
300302
readonly createUnrefFn: UnwrapRef<typeof import('@vueuse/core')['createUnrefFn']>
301303
readonly customRef: UnwrapRef<typeof import('vue')['customRef']>
302304
readonly debouncedRef: UnwrapRef<typeof import('@vueuse/core')['debouncedRef']>
@@ -410,13 +412,17 @@ declare module '@vue/runtime-core' {
410412
readonly useDateFormat: UnwrapRef<typeof import('@vueuse/core')['useDateFormat']>
411413
readonly useDebounce: UnwrapRef<typeof import('@vueuse/core')['useDebounce']>
412414
readonly useDebounceFn: UnwrapRef<typeof import('@vueuse/core')['useDebounceFn']>
413-
readonly useDebouncedRefHistory: UnwrapRef<typeof import('@vueuse/core')['useDebouncedRefHistory']>
415+
readonly useDebouncedRefHistory: UnwrapRef<
416+
typeof import('@vueuse/core')['useDebouncedRefHistory']
417+
>
414418
readonly useDeviceMotion: UnwrapRef<typeof import('@vueuse/core')['useDeviceMotion']>
415419
readonly useDeviceOrientation: UnwrapRef<typeof import('@vueuse/core')['useDeviceOrientation']>
416420
readonly useDevicePixelRatio: UnwrapRef<typeof import('@vueuse/core')['useDevicePixelRatio']>
417421
readonly useDevicesList: UnwrapRef<typeof import('@vueuse/core')['useDevicesList']>
418422
readonly useDisplayMedia: UnwrapRef<typeof import('@vueuse/core')['useDisplayMedia']>
419-
readonly useDocumentVisibility: UnwrapRef<typeof import('@vueuse/core')['useDocumentVisibility']>
423+
readonly useDocumentVisibility: UnwrapRef<
424+
typeof import('@vueuse/core')['useDocumentVisibility']
425+
>
420426
readonly useDraggable: UnwrapRef<typeof import('@vueuse/core')['useDraggable']>
421427
readonly useDropZone: UnwrapRef<typeof import('@vueuse/core')['useDropZone']>
422428
readonly useElementBounding: UnwrapRef<typeof import('@vueuse/core')['useElementBounding']>
@@ -443,7 +449,9 @@ declare module '@vue/runtime-core' {
443449
readonly useIdle: UnwrapRef<typeof import('@vueuse/core')['useIdle']>
444450
readonly useImage: UnwrapRef<typeof import('@vueuse/core')['useImage']>
445451
readonly useInfiniteScroll: UnwrapRef<typeof import('@vueuse/core')['useInfiniteScroll']>
446-
readonly useIntersectionObserver: UnwrapRef<typeof import('@vueuse/core')['useIntersectionObserver']>
452+
readonly useIntersectionObserver: UnwrapRef<
453+
typeof import('@vueuse/core')['useIntersectionObserver']
454+
>
447455
readonly useInterval: UnwrapRef<typeof import('@vueuse/core')['useInterval']>
448456
readonly useIntervalFn: UnwrapRef<typeof import('@vueuse/core')['useIntervalFn']>
449457
readonly useKeyModifier: UnwrapRef<typeof import('@vueuse/core')['useKeyModifier']>
@@ -471,10 +479,16 @@ declare module '@vue/runtime-core' {
471479
readonly usePermission: UnwrapRef<typeof import('@vueuse/core')['usePermission']>
472480
readonly usePointer: UnwrapRef<typeof import('@vueuse/core')['usePointer']>
473481
readonly usePointerSwipe: UnwrapRef<typeof import('@vueuse/core')['usePointerSwipe']>
474-
readonly usePreferredColorScheme: UnwrapRef<typeof import('@vueuse/core')['usePreferredColorScheme']>
482+
readonly usePreferredColorScheme: UnwrapRef<
483+
typeof import('@vueuse/core')['usePreferredColorScheme']
484+
>
475485
readonly usePreferredDark: UnwrapRef<typeof import('@vueuse/core')['usePreferredDark']>
476-
readonly usePreferredLanguages: UnwrapRef<typeof import('@vueuse/core')['usePreferredLanguages']>
477-
readonly usePreferredReducedMotion: UnwrapRef<typeof import('@vueuse/core')['usePreferredReducedMotion']>
486+
readonly usePreferredLanguages: UnwrapRef<
487+
typeof import('@vueuse/core')['usePreferredLanguages']
488+
>
489+
readonly usePreferredReducedMotion: UnwrapRef<
490+
typeof import('@vueuse/core')['usePreferredReducedMotion']
491+
>
478492
readonly useRafFn: UnwrapRef<typeof import('@vueuse/core')['useRafFn']>
479493
readonly useRefHistory: UnwrapRef<typeof import('@vueuse/core')['useRefHistory']>
480494
readonly useResizeObserver: UnwrapRef<typeof import('@vueuse/core')['useResizeObserver']>
@@ -502,7 +516,9 @@ declare module '@vue/runtime-core' {
502516
readonly useTextareaAutosize: UnwrapRef<typeof import('@vueuse/core')['useTextareaAutosize']>
503517
readonly useThrottle: UnwrapRef<typeof import('@vueuse/core')['useThrottle']>
504518
readonly useThrottleFn: UnwrapRef<typeof import('@vueuse/core')['useThrottleFn']>
505-
readonly useThrottledRefHistory: UnwrapRef<typeof import('@vueuse/core')['useThrottledRefHistory']>
519+
readonly useThrottledRefHistory: UnwrapRef<
520+
typeof import('@vueuse/core')['useThrottledRefHistory']
521+
>
506522
readonly useTimeAgo: UnwrapRef<typeof import('@vueuse/core')['useTimeAgo']>
507523
readonly useTimeout: UnwrapRef<typeof import('@vueuse/core')['useTimeout']>
508524
readonly useTimeoutFn: UnwrapRef<typeof import('@vueuse/core')['useTimeoutFn']>

‎fixtures/vitesse/src/components/Counter.vue

+2-6
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ const { count, inc, dec } = useCounter(props.initial)
99
<template>
1010
<div>
1111
{{ count }}
12-
<button class="inc" @click="inc()">
13-
+
14-
</button>
15-
<button class="dec" @click="dec()">
16-
-
17-
</button>
12+
<button class="inc" @click="inc()">+</button>
13+
<button class="dec" @click="dec()">-</button>
1814
</div>
1915
</template>

‎fixtures/vitesse/src/components/Footer.vue

+12-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ function toggleLocales() {
1414
<div i-carbon-campsite />
1515
</RouterLink>
1616

17-
<button class="icon-btn mx-2 !outline-none" :title="t('button.toggle_dark')" @click="toggleDark()">
17+
<button
18+
class="icon-btn mx-2 !outline-none"
19+
:title="t('button.toggle_dark')"
20+
@click="toggleDark()"
21+
>
1822
<div i="carbon-sun dark:carbon-moon" />
1923
</button>
2024

@@ -26,7 +30,13 @@ function toggleLocales() {
2630
<div i-carbon-dicom-overlay />
2731
</RouterLink>
2832

29-
<a class="icon-btn mx-2" rel="noreferrer" href="https://github.com/antfu/vitesse" target="_blank" title="GitHub">
33+
<a
34+
class="icon-btn mx-2"
35+
rel="noreferrer"
36+
href="https://github.com/antfu/vitesse"
37+
target="_blank"
38+
title="GitHub"
39+
>
3040
<div i-carbon-logo-github />
3141
</a>
3242
</nav>

‎fixtures/vitesse/src/components/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
Components in this dir will be auto-registered and on-demand, powered by [`unplugin-vue-components`](https://github.com/antfu/unplugin-vue-components).
44

5-
65
### Icons
76

87
You can use icons from almost any icon sets by the power of [Iconify](https://iconify.design/).

‎fixtures/vitesse/src/layouts/README.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,5 @@ By default, `default.vue` will be used unless an alternative is specified in the
77
With [`vite-plugin-pages`](https://github.com/hannoeru/vite-plugin-pages) and [`vite-plugin-vue-layouts`](https://github.com/JohnCampionJr/vite-plugin-vue-layouts), you can specify the layout in the page's SFCs like this:
88

99
```html
10-
<route lang="yaml">
11-
meta:
12-
layout: home
13-
</route>
10+
<route lang="yaml"> meta: layout: home </route>
1411
```

‎fixtures/vitesse/src/layouts/default.vue

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
<main class="px-4 py-10 text-center text-gray-700 dark:text-gray-200">
33
<RouterView />
44
<Footer />
5-
<div class="mt-5 mx-auto text-center opacity-75 dark:opacity-50 text-sm">
6-
[Default Layout]
7-
</div>
5+
<div class="mx-auto mt-5 text-center text-sm opacity-75 dark:opacity-50">[Default Layout]</div>
86
</main>
97
</template>

‎fixtures/vitesse/src/layouts/home.vue

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
<main class="px-4 py-10 text-center text-gray-700 dark:text-gray-200">
33
<RouterView />
44
<Footer />
5-
<div class="mt-5 mx-auto text-center opacity-75 dark:opacity-50 text-sm">
6-
[Home Layout]
7-
</div>
5+
<div class="mx-auto mt-5 text-center text-sm opacity-75 dark:opacity-50">[Home Layout]</div>
86
</main>
97
</template>

‎fixtures/vitesse/src/main.ts

+6-9
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@ import 'uno.css'
1111
const routes = setupLayouts(generatedRoutes)
1212

1313
// https://github.com/antfu/vite-ssg
14-
export const createApp = ViteSSG(
15-
App,
16-
{ routes, base: import.meta.env.BASE_URL },
17-
(ctx) => {
18-
// install all modules under `modules/`
19-
Object.values(import.meta.glob<{ install: UserModule }>('./modules/*.ts', { eager: true }))
20-
.forEach(i => i.install?.(ctx))
21-
},
22-
)
14+
export const createApp = ViteSSG(App, { routes, base: import.meta.env.BASE_URL }, (ctx) => {
15+
// install all modules under `modules/`
16+
Object.values(
17+
import.meta.glob<{ install: UserModule }>('./modules/*.ts', { eager: true }),
18+
).forEach((i) => i.install?.(ctx))
19+
})

‎fixtures/vitesse/src/modules/i18n.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import { type UserModule } from '~/types'
77
// Don't need this? Try vitesse-lite: https://github.com/antfu/vitesse-lite
88
const messages = Object.fromEntries(
99
Object.entries(
10-
import.meta.glob<{ default: any }>('../../locales/*.y(a)?ml', { eager: true }))
11-
.map(([key, value]) => {
12-
const yaml = key.endsWith('.yaml')
13-
return [key.slice(14, yaml ? -5 : -4), value.default]
14-
}),
10+
import.meta.glob<{ default: any }>('../../locales/*.y(a)?ml', { eager: true }),
11+
).map(([key, value]) => {
12+
const yaml = key.endsWith('.yaml')
13+
return [key.slice(14, yaml ? -5 : -4), value.default]
14+
}),
1515
)
1616

1717
export const install: UserModule = ({ app }) => {

‎fixtures/vitesse/src/modules/nprogress.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import { type UserModule } from '~/types'
44
export const install: UserModule = ({ isClient, router }) => {
55
if (isClient) {
66
router.beforeEach((to, from) => {
7-
if (to.path !== from.path)
8-
NProgress.start()
7+
if (to.path !== from.path) NProgress.start()
98
})
109
router.afterEach(() => {
1110
NProgress.done()

‎fixtures/vitesse/src/modules/pinia.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ export const install: UserModule = ({ isClient, initialState, app }) => {
99
// Refer to
1010
// https://github.com/antfu/vite-ssg/blob/main/README.md#state-serialization
1111
// for other serialization strategies.
12-
if (isClient)
13-
pinia.state.value = (initialState.pinia) || {}
14-
15-
else
16-
initialState.pinia = pinia.state.value
12+
if (isClient) pinia.state.value = initialState.pinia || {}
13+
else initialState.pinia = pinia.state.value
1714
}

‎fixtures/vitesse/src/modules/pwa.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { type UserModule } from '~/types'
22

33
// https://github.com/antfu/vite-plugin-pwa#automatic-reload-when-new-content-available
44
export const install: UserModule = ({ isClient, router }) => {
5-
if (!isClient)
6-
return
5+
if (!isClient) return
76

87
router.isReady().then(async () => {
98
const { registerSW } = await import('virtual:pwa-register')

‎fixtures/vitesse/src/pages/hi/[name].vue

+3-6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ watchEffect(() => {
2323
</p>
2424

2525
<template v-if="user.otherNames.length">
26-
<p text-sm mt-4>
26+
<div text-sm mt-4>
2727
<span opacity-75>{{ t('intro.aka') }}:</span>
2828
<ul>
2929
<li v-for="otherName in user.otherNames" :key="otherName">
@@ -32,14 +32,11 @@ watchEffect(() => {
3232
</router-link>
3333
</li>
3434
</ul>
35-
</p>
35+
</div>
3636
</template>
3737

3838
<div>
39-
<button
40-
btn m="3 t6" text-sm
41-
@click="router.back()"
42-
>
39+
<button btn m="3 t6" text-sm @click="router.back()">
4340
{{ t('button.back') }}
4441
</button>
4542
</div>

‎fixtures/vitesse/src/pages/index.vue

+4-11
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ const name = $ref(user.savedName)
44
55
const router = useRouter()
66
function go() {
7-
if (name)
8-
router.push(`/hi/${encodeURIComponent(name)}`)
7+
if (name) router.push(`/hi/${encodeURIComponent(name)}`)
98
}
109
1110
const { t } = useI18n()
@@ -17,9 +16,7 @@ const { t } = useI18n()
1716
<div i-carbon-campsite inline-block />
1817
</div>
1918
<p>
20-
<a rel="noreferrer" href="https://github.com/antfu/vitesse" target="_blank">
21-
Vitesse
22-
</a>
19+
<a rel="noreferrer" href="https://github.com/antfu/vitesse" target="_blank"> Vitesse </a>
2320
</p>
2421
<p>
2522
<em text-sm opacity-75>{{ t('intro.desc') }}</em>
@@ -41,15 +38,11 @@ const { t } = useI18n()
4138
border="~ rounded gray-200 dark:gray-700"
4239
outline="none active:none"
4340
@keydown.enter="go"
44-
>
41+
/>
4542
<label class="hidden" for="input">{{ t('intro.whats-your-name') }}</label>
4643

4744
<div>
48-
<button
49-
btn m-3 text-sm
50-
:disabled="!name"
51-
@click="go"
52-
>
45+
<button btn m-3 text-sm :disabled="!name" @click="go">
5346
{{ t('button.go') }}
5447
</button>
5548
</div>

‎fixtures/vitesse/src/store/user.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const useUserStore = defineStore('user', () => {
88
const previousNames = ref(new Set<string>())
99

1010
const usedNames = computed(() => Array.from(previousNames.value))
11-
const otherNames = computed(() => usedNames.value.filter(name => name !== savedName.value))
11+
const otherNames = computed(() => usedNames.value.filter((name) => name !== savedName.value))
1212

1313
/**
1414
* Changes the current name of the user and saves the one that was used
@@ -17,8 +17,7 @@ export const useUserStore = defineStore('user', () => {
1717
* @param name - new name to set
1818
*/
1919
function setNewName(name: string) {
20-
if (savedName.value)
21-
previousNames.value.add(savedName.value)
20+
if (savedName.value) previousNames.value.add(savedName.value)
2221

2322
savedName.value = name
2423
}
@@ -30,5 +29,4 @@ export const useUserStore = defineStore('user', () => {
3029
}
3130
})
3231

33-
if (import.meta.hot)
34-
import.meta.hot.accept(acceptHMRUpdate(useUserStore, import.meta.hot))
32+
if (import.meta.hot) import.meta.hot.accept(acceptHMRUpdate(useUserStore, import.meta.hot))

‎fixtures/vitesse/src/styles/main.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ html.dark {
1818
}
1919

2020
#nprogress .bar {
21-
background: rgb(13,148,136);
21+
background: rgb(13, 148, 136);
2222
opacity: 0.75;
2323
position: fixed;
2424
z-index: 1031;

‎fixtures/vitesse/unocss.config.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ import {
1111

1212
export default defineConfig({
1313
shortcuts: [
14-
['btn', 'px-4 py-1 rounded inline-block bg-teal-700 text-white cursor-pointer hover:bg-teal-800 disabled:cursor-default disabled:bg-gray-600 disabled:opacity-50'],
15-
['icon-btn', 'inline-block cursor-pointer select-none opacity-75 transition duration-200 ease-in-out hover:opacity-100 hover:text-teal-600'],
14+
[
15+
'btn',
16+
'px-4 py-1 rounded inline-block bg-teal-700 text-white cursor-pointer hover:bg-teal-800 disabled:cursor-default disabled:bg-gray-600 disabled:opacity-50',
17+
],
18+
[
19+
'icon-btn',
20+
'inline-block cursor-pointer select-none opacity-75 transition duration-200 ease-in-out hover:opacity-100 hover:text-teal-600',
21+
],
1622
],
1723
presets: [
1824
presetUno(),
@@ -30,9 +36,6 @@ export default defineConfig({
3036
},
3137
}),
3238
],
33-
transformers: [
34-
transformerDirectives(),
35-
transformerVariantGroup(),
36-
],
39+
transformers: [transformerDirectives(), transformerVariantGroup()],
3740
safelist: 'prose prose-sm m-auto text-left'.split(' '),
3841
})

‎fixtures/vitesse/vite.config.ts

+5-13
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,9 @@ export default defineConfig({
3737

3838
// https://github.com/antfu/unplugin-auto-import
3939
AutoImport({
40-
imports: [
41-
'vue',
42-
'vue-router',
43-
'vue-i18n',
44-
'vue/macros',
45-
'@vueuse/head',
46-
'@vueuse/core',
47-
],
40+
imports: ['vue', 'vue-router', 'vue-i18n', 'vue/macros', '@vueuse/head', '@vueuse/core'],
4841
dts: 'src/auto-imports.d.ts',
49-
dirs: [
50-
'src/composables',
51-
'src/store',
52-
],
42+
dirs: ['src/composables', 'src/store'],
5343
vueTemplate: true,
5444
}),
5545

@@ -143,7 +133,9 @@ export default defineConfig({
143133
ssgOptions: {
144134
script: 'async',
145135
formatting: 'minify',
146-
onFinished() { generateSitemap() },
136+
onFinished() {
137+
generateSitemap()
138+
},
147139
},
148140

149141
ssr: {

‎package.json

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"license": "MIT",
88
"scripts": {
99
"lint": "eslint .",
10+
"format": "prettier . --check",
1011
"release": "bumpp package.json packages/*/package.json --commit --push --tag && pnpm -r publish --access public"
1112
},
1213
"devDependencies": {

‎packages/jcamp/.prettierrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ module.exports = {
99
trailingComma: 'all',
1010
semi: false,
1111
singleAttributePerLine: false,
12-
plugins: [require('prettier-plugin-tailwindcss')],
12+
plugins: ['prettier-plugin-tailwindcss'],
1313
}

‎packages/jcamp/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"license": "MIT",
77
"homepage": "https://github.com/jcamp/eslint-config",
88
"keywords": [
9-
"eslint-config"
9+
"eslint-config",
10+
"prettier"
1011
],
1112
"main": "index.js",
1213
"files": [
@@ -15,7 +16,7 @@
1516
],
1617
"peerDependencies": {
1718
"eslint": ">=8.45.0",
18-
"prettier": ">=2.8.8 < 4.0.0"
19+
"prettier": ">=3.0.0"
1920
},
2021
"dependencies": {
2122
"@antfu/eslint-config-vue": "^0.39.8",

‎pnpm-workspace.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
packages:
2-
- 'packages/*'
3-
- 'test-dev'
2+
- packages/*
3+
- test-dev

0 commit comments

Comments
 (0)
Please sign in to comment.