chore: 添加prettier

This commit is contained in:
2025-12-19 14:02:50 +08:00
parent f2214f3b46
commit 5e6e4b2960
5 changed files with 71 additions and 1 deletions

9
.prettierignore Normal file
View File

@ -0,0 +1,9 @@
# Package Managers
package-lock.json
pnpm-lock.yaml
yarn.lock
bun.lock
bun.lockb
# Miscellaneous
/static/

17
.prettierrc Normal file
View File

@ -0,0 +1,17 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": [
"prettier-plugin-svelte"
],
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
]
}

View File

@ -1,3 +1,4 @@
import prettier from 'eslint-config-prettier';
import { fileURLToPath } from 'node:url';
import { includeIgnoreFile } from '@eslint/compat';
import js from '@eslint/js';
@ -14,6 +15,8 @@ export default defineConfig(
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs.recommended,
prettier,
...svelte.configs.prettier,
{
languageOptions: { globals: { ...globals.browser, ...globals.node } },

View File

@ -10,7 +10,8 @@
"prepare": "svelte-kit sync || echo ''",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "eslint ."
"lint": "eslint . && prettier --check .",
"format": "prettier --write ."
},
"engines": {
"node": ">=20",
@ -25,8 +26,11 @@
"@sveltejs/vite-plugin-svelte": "^6.2.1",
"@types/node": "^22",
"eslint": "^9.39.1",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-svelte": "^3.13.1",
"globals": "^16.5.0",
"prettier": "^3.7.4",
"prettier-plugin-svelte": "^3.4.0",
"svelte": "^5.45.6",
"svelte-check": "^4.3.4",
"typescript": "^5.9.3",

37
pnpm-lock.yaml generated
View File

@ -29,12 +29,21 @@ importers:
eslint:
specifier: ^9.39.1
version: 9.39.2
eslint-config-prettier:
specifier: ^10.1.8
version: 10.1.8(eslint@9.39.2)
eslint-plugin-svelte:
specifier: ^3.13.1
version: 3.13.1(eslint@9.39.2)(svelte@5.46.0)
globals:
specifier: ^16.5.0
version: 16.5.0
prettier:
specifier: ^3.7.4
version: 3.7.4
prettier-plugin-svelte:
specifier: ^3.4.0
version: 3.4.1(prettier@3.7.4)(svelte@5.46.0)
svelte:
specifier: ^5.45.6
version: 5.46.0
@ -617,6 +626,12 @@ packages:
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
engines: {node: '>=10'}
eslint-config-prettier@10.1.8:
resolution: {integrity: sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==}
hasBin: true
peerDependencies:
eslint: '>=7.0.0'
eslint-plugin-svelte@3.13.1:
resolution: {integrity: sha512-Ng+kV/qGS8P/isbNYVE3sJORtubB+yLEcYICMkUWNaDTb0SwZni/JhAYXh/Dz/q2eThUwWY0VMPZ//KYD1n3eQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
@ -896,6 +911,17 @@ packages:
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
engines: {node: '>= 0.8.0'}
prettier-plugin-svelte@3.4.1:
resolution: {integrity: sha512-xL49LCloMoZRvSwa6IEdN2GV6cq2IqpYGstYtMT+5wmml1/dClEoI0MZR78MiVPpu6BdQFfN0/y73yO6+br5Pg==}
peerDependencies:
prettier: ^3.0.0
svelte: ^3.2.0 || ^4.0.0-next.0 || ^5.0.0-next.0
prettier@3.7.4:
resolution: {integrity: sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==}
engines: {node: '>=14'}
hasBin: true
punycode@2.3.1:
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
engines: {node: '>=6'}
@ -1564,6 +1590,10 @@ snapshots:
escape-string-regexp@4.0.0: {}
eslint-config-prettier@10.1.8(eslint@9.39.2):
dependencies:
eslint: 9.39.2
eslint-plugin-svelte@3.13.1(eslint@9.39.2)(svelte@5.46.0):
dependencies:
'@eslint-community/eslint-utils': 4.9.0(eslint@9.39.2)
@ -1828,6 +1858,13 @@ snapshots:
prelude-ls@1.2.1: {}
prettier-plugin-svelte@3.4.1(prettier@3.7.4)(svelte@5.46.0):
dependencies:
prettier: 3.7.4
svelte: 5.46.0
prettier@3.7.4: {}
punycode@2.3.1: {}
readdirp@4.1.2: {}