1
0

Impl prettier to project

- Add prettier json config
- Format project with prettier config
- Enable prettier in zed project settings

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2025-12-08 00:06:01 +08:00
parent 3e06961805
commit 6845bcb208
7 changed files with 75 additions and 52 deletions

21
.prettierrc.json Normal file
View File

@@ -0,0 +1,21 @@
{
"printWidth": 120,
"tabWidth": 4,
"useTabs": false,
"semi": true,
"singleQuote": true,
"quoteProps": "as-needed",
"jsxSingleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"objectWarp": "preserve",
"bracketSameLine": false,
"arrowParens": "always",
"parser": "typescript",
"poseWrap": "preserve",
"htmlWhitespaceSensitivity": "ignore",
"vueIndentScriptAndStyle": false,
"endOfLine": "lf",
"embeddedLanguageFormatting": "auto",
"singleAttributePerLine": false
}

View File

@@ -1 +1 @@
nodeLinker: node-modules
nodeLinker: node - modules;

View File

@@ -4,6 +4,8 @@
// see the documentation: https://zed.dev/docs/configuring-zed#settings-files
{
"format_on_save": "on",
"formatter": "prettier",
"languages": {
"TypeScript": {
"language_servers": [

View File

@@ -1,35 +1,35 @@
// @ts-check
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import starlightThemeGalaxy from "starlight-theme-galaxy";
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import starlightThemeGalaxy from 'starlight-theme-galaxy';
import mdx from "@astrojs/mdx";
import mdx from '@astrojs/mdx';
// https://astro.build/config
export default defineConfig({
integrations: [
starlight({
title: "NixCN",
defaultLocale: "root",
locales: {
root: {
label: "简体中文",
lang: "zh-CN",
},
en: {
label: "English",
},
},
social: [
{
icon: "github",
label: "GitHub",
href: "https://github.com/withastro/starlight",
},
],
sidebar: [],
plugins: [starlightThemeGalaxy()],
}),
mdx(),
],
integrations: [
starlight({
title: 'NixCN',
defaultLocale: 'root',
locales: {
root: {
label: '简体中文',
lang: 'zh-CN',
},
en: {
label: 'English',
},
},
social: [
{
icon: 'github',
label: 'GitHub',
href: 'https://github.com/withastro/starlight',
},
],
sidebar: [],
plugins: [starlightThemeGalaxy()],
}),
mdx(),
],
});

View File

@@ -1,20 +1,20 @@
{
"name": "nixcn-web",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/mdx": "^4.3.12",
"@astrojs/starlight": "^0.37.0",
"astro": "^5.6.1",
"sharp": "^0.34.2",
"starlight-theme-galaxy": "^0.5.2"
},
"packageManager": "yarn@4.12.0"
"name": "nixcn-web",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/mdx": "^4.3.12",
"@astrojs/starlight": "^0.37.0",
"astro": "^5.6.1",
"sharp": "^0.34.2",
"starlight-theme-galaxy": "^0.5.2"
},
"packageManager": "yarn@4.12.0"
}

View File

@@ -3,5 +3,5 @@ import { docsLoader } from '@astrojs/starlight/loaders';
import { docsSchema } from '@astrojs/starlight/schema';
export const collections = {
docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
};

View File

@@ -1,5 +1,5 @@
{
"extends": "astro/tsconfigs/strict",
"include": [".astro/types.d.ts", "**/*"],
"exclude": ["dist"]
"extends": "astro/tsconfigs/strict",
"include": [".astro/types.d.ts", "**/*"],
"exclude": ["dist"]
}