Skip to content

Commit 3c08550

Browse files
authored
chore(docs): use vitepress (#114)
1 parent 3b53a57 commit 3c08550

33 files changed

+1747
-292
lines changed

.eslintignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
!.vuepress
1+
!.vitepress
22

33
/coverage
4-
/docs/.vuepress/dist
4+
/docs/.vitepress/dist
5+
/docs/.vitepress/cache
56
/node_modules

.github/workflows/GHPages.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ jobs:
3535

3636
- name: Build docs
3737
run: |+
38-
export NODE_OPTIONS=--openssl-legacy-provider
3938
npm run docs:build
4039
4140
- name: Setup Pages
@@ -44,7 +43,7 @@ jobs:
4443
- name: Upload artifact
4544
uses: actions/upload-pages-artifact@v2
4645
with:
47-
path: ./docs/.vuepress/dist
46+
path: ./docs/.vitepress/dist/eslint-plugin-eslint-comments
4847

4948
- name: Deploy to GitHub Pages
5049
id: deployment

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/.nyc_output
22
/.vscode
33
/coverage
4-
/docs/.vuepress/dist
4+
/docs/.vitepress/dist
5+
/docs/.vitepress/cache
56
/node_modules
67
/npm-debug.log
78
/test.js

docs/.vitepress/.eslintrc.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"use strict"
2+
3+
module.exports = {
4+
rules: {
5+
"n/no-missing-import": "off",
6+
"n/no-extraneous-import": "off",
7+
"n/file-extension-in-import": "off",
8+
"n/no-extraneous-require": "off",
9+
},
10+
globals: {
11+
window: "readonly",
12+
document: "readonly",
13+
},
14+
overrides: [
15+
{
16+
files: ["*.vue"],
17+
rules: {
18+
"vue/multiline-html-element-content-newline": "off",
19+
"vue/singleline-html-element-content-newline": "off",
20+
"vue/name-property-casing": "off",
21+
"vue/html-self-closing": "off",
22+
"vue/comma-dangle": "off",
23+
},
24+
},
25+
],
26+
}

docs/.vitepress/config.mjs

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import { defineConfig } from "vitepress"
2+
import path from "path"
3+
import { fileURLToPath } from "url"
4+
import { vitePluginGetLinter, viteCommonjs } from "./vite-plugin.mjs"
5+
import eslint4b from "vite-plugin-eslint4b"
6+
import { createRequire } from "module"
7+
8+
const __filename = fileURLToPath(import.meta.url)
9+
const __dirname = path.dirname(__filename)
10+
const require = createRequire(import.meta.url)
11+
12+
const { withCategories } = require("../../scripts/lib/rules")
13+
require("../../scripts/update-docs-headers")
14+
require("../../scripts/update-docs-index")
15+
16+
export default defineConfig({
17+
title: "eslint-plugin-eslint-comments",
18+
base: "/eslint-plugin-eslint-comments/",
19+
description: "Additional ESLint rules for ESLint directive comments.",
20+
head: [["link", { rel: "icon", href: "/favicon.png" }]],
21+
22+
outDir: path.resolve(__dirname, "./dist/eslint-plugin-eslint-comments"),
23+
vite: {
24+
publicDir: path.resolve(__dirname, "./public"),
25+
plugins: [eslint4b(), vitePluginGetLinter(), viteCommonjs()],
26+
define: {
27+
MONACO_EDITOR_VERSION: JSON.stringify(
28+
require("monaco-editor/package.json").version
29+
),
30+
},
31+
},
32+
33+
lastUpdated: true,
34+
themeConfig: {
35+
search: {
36+
provider: "local",
37+
options: {
38+
detailedView: true,
39+
},
40+
},
41+
editLink: {
42+
pattern:
43+
"https://github.com/eslint-community/eslint-plugin-eslint-comments/edit/main/docs/:path",
44+
},
45+
socialLinks: [
46+
{
47+
icon: "github",
48+
link: "https://github.com/eslint-community/eslint-plugin-eslint-comments",
49+
},
50+
],
51+
52+
nav: [
53+
{ text: "Guide", link: "/" },
54+
{ text: "Rules", link: "/rules/" },
55+
],
56+
57+
sidebar: [
58+
{
59+
items: [
60+
{ text: "Guide", link: "/" },
61+
{ text: "Available Rules", link: "/rules/" },
62+
],
63+
},
64+
...withCategories.map(({ category, rules }) => ({
65+
text: `Rules in ${category}`,
66+
collapsable: false,
67+
items: rules.map((rule) => ({
68+
text: `eslint-comments/${rule.name}`,
69+
link: `/rules/${rule.name}`,
70+
})),
71+
})),
72+
],
73+
},
74+
})

0 commit comments

Comments
 (0)