init eslint

eslint
undefined 2023-12-01 16:41:12 +08:00
parent 5f78099325
commit d06687867a
7 changed files with 46 additions and 34 deletions

4
.eslintignore 100644
View File

@ -0,0 +1,4 @@
!.vitepress
node_modules
dist
cache

5
.eslintrc.yaml 100644
View File

@ -0,0 +1,5 @@
extends:
- '@hydrooj/eslint-config'
rules:
'@typescript-eslint/semi': [error, never]
'@typescript-eslint/indent': [error, 2]

View File

@ -1,19 +1,19 @@
import footnote from 'markdown-it-footnote'
import katex from 'markdown-it-katex'
import mdPangu from 'markdown-it-pangu'
import { defineConfig } from 'vitepress' import { defineConfig } from 'vitepress'
import nav from './nav'
import mdPangu from "markdown-it-pangu";
import katex from 'markdown-it-katex';
import footnote from 'markdown-it-footnote';
import { getSidebar } from 'vitepress-plugin-auto-sidebar' import { getSidebar } from 'vitepress-plugin-auto-sidebar'
import nav from './nav'
// https://vitepress.dev/reference/site-config // https://vitepress.dev/reference/site-config
export default defineConfig({ export default defineConfig({
title: "RLE.wiki", title: 'RLE.wiki',
description: "一份RLE指北", description: '一份RLE指北',
markdown: { markdown: {
config(md) { config(md) {
md.use(mdPangu); md.use(mdPangu)
md.use(footnote); md.use(footnote)
md.use(katex); md.use(katex)
}, },
}, },
dir: 'docs', dir: 'docs',
@ -30,7 +30,7 @@ export default defineConfig({
}), }),
socialLinks: [ socialLinks: [
{ icon: 'github', link: 'https://github.com/project-trans/RLE-wiki' } { icon: 'github', link: 'https://github.com/project-trans/RLE-wiki' },
], ],
editLink: { editLink: {
@ -48,5 +48,5 @@ export default defineConfig({
prev: '上一页', prev: '上一页',
next: '下一页', next: '下一页',
}, },
} },
}) })

View File

@ -2,25 +2,25 @@ import { DefaultTheme } from 'vitepress'
const nav = [ const nav = [
{ {
text: "大学指南", text: '大学指南',
link: "/campus/", link: '/campus/',
}, },
{ {
text: "Fashion", text: 'Fashion',
link: "/fashion/", link: '/fashion/',
}, },
{ {
text: "贡献指南", text: '贡献指南',
items: [{ items: [{
text: "校园版块投稿指南", text: '校园版块投稿指南',
link: "/contributor-guide/campus.md", link: '/contributor-guide/campus.md',
}, { }, {
text: "其他投稿指南", text: '其他投稿指南',
link: "/contributor-guide/other.md", link: '/contributor-guide/other.md',
}, { }, {
text: "校园版块贡献模板", text: '校园版块贡献模板',
link: "/contributor-guide/CampusTemplate.md", link: '/contributor-guide/CampusTemplate.md',
}], }],
}, },
] satisfies DefaultTheme.Config['nav']; ] satisfies DefaultTheme.Config['nav']
export default nav; export default nav

View File

@ -1,17 +1,16 @@
// https://vitepress.dev/guide/custom-theme // https://vitepress.dev/guide/custom-theme
import { h } from 'vue' import './style.css'
import type { Theme } from 'vitepress' import type { Theme } from 'vitepress'
import DefaultTheme from 'vitepress/theme' import DefaultTheme from 'vitepress/theme'
import './style.css' import { h } from 'vue'
export default { export default {
extends: DefaultTheme, extends: DefaultTheme,
Layout: () => { Layout: () => h(DefaultTheme.Layout, null, {
return h(DefaultTheme.Layout, null, { // https://vitepress.dev/guide/extending-default-theme#layout-slots
// https://vitepress.dev/guide/extending-default-theme#layout-slots }),
})
},
enhanceApp({ app, router, siteData }) { enhanceApp({ app, router, siteData }) {
// ... // ...
} },
} satisfies Theme } satisfies Theme

View File

@ -11,14 +11,18 @@
"build:old": "vuepress build docs", "build:old": "vuepress build docs",
"clean-dev:old": "vuepress dev docs --clean-cache", "clean-dev:old": "vuepress dev docs --clean-cache",
"dev:old": "vuepress dev docs", "dev:old": "vuepress dev docs",
"update-package": "pnpm dlx vp-update" "update-package": "pnpm dlx vp-update",
"lint": "eslint docs --ext .ts,.vue,.md"
}, },
"devDependencies": { "devDependencies": {
"@hydrooj/eslint-config": "^1.0.6",
"@types/markdown-it": "^13.0.7", "@types/markdown-it": "^13.0.7",
"@types/markdown-it-footnote": "^3.0.3", "@types/markdown-it-footnote": "^3.0.3",
"eslint": "^8.54.0",
"markdown-it-footnote": "^3.0.3", "markdown-it-footnote": "^3.0.3",
"markdown-it-katex": "^2.0.3", "markdown-it-katex": "^2.0.3",
"markdown-it-pangu": "^1.0.2", "markdown-it-pangu": "^1.0.2",
"typescript": "^5.3.2",
"vitepress": "^1.0.0-rc.31", "vitepress": "^1.0.0-rc.31",
"vitepress-plugin-auto-sidebar": "^1.1.0", "vitepress-plugin-auto-sidebar": "^1.1.0",
"vue": "^3.3.8", "vue": "^3.3.8",