Skip to content

Commit

Permalink
chore(docs): use vitepress (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Oct 6, 2023
1 parent 3b53a57 commit 3c08550
Show file tree
Hide file tree
Showing 33 changed files with 1,747 additions and 292 deletions.
5 changes: 3 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
!.vuepress
!.vitepress

/coverage
/docs/.vuepress/dist
/docs/.vitepress/dist
/docs/.vitepress/cache
/node_modules
3 changes: 1 addition & 2 deletions .github/workflows/GHPages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ jobs:

- name: Build docs
run: |+
export NODE_OPTIONS=--openssl-legacy-provider
npm run docs:build
- name: Setup Pages
Expand All @@ -44,7 +43,7 @@ jobs:
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./docs/.vuepress/dist
path: ./docs/.vitepress/dist/eslint-plugin-eslint-comments

- name: Deploy to GitHub Pages
id: deployment
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/.nyc_output
/.vscode
/coverage
/docs/.vuepress/dist
/docs/.vitepress/dist
/docs/.vitepress/cache
/node_modules
/npm-debug.log
/test.js
26 changes: 26 additions & 0 deletions docs/.vitepress/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"use strict"

module.exports = {
rules: {
"n/no-missing-import": "off",
"n/no-extraneous-import": "off",
"n/file-extension-in-import": "off",
"n/no-extraneous-require": "off",
},
globals: {
window: "readonly",
document: "readonly",
},
overrides: [
{
files: ["*.vue"],
rules: {
"vue/multiline-html-element-content-newline": "off",
"vue/singleline-html-element-content-newline": "off",
"vue/name-property-casing": "off",
"vue/html-self-closing": "off",
"vue/comma-dangle": "off",
},
},
],
}
74 changes: 74 additions & 0 deletions docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { defineConfig } from "vitepress"
import path from "path"
import { fileURLToPath } from "url"
import { vitePluginGetLinter, viteCommonjs } from "./vite-plugin.mjs"
import eslint4b from "vite-plugin-eslint4b"
import { createRequire } from "module"

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const require = createRequire(import.meta.url)

const { withCategories } = require("../../scripts/lib/rules")
require("../../scripts/update-docs-headers")
require("../../scripts/update-docs-index")

export default defineConfig({
title: "eslint-plugin-eslint-comments",
base: "/eslint-plugin-eslint-comments/",
description: "Additional ESLint rules for ESLint directive comments.",
head: [["link", { rel: "icon", href: "/favicon.png" }]],

outDir: path.resolve(__dirname, "./dist/eslint-plugin-eslint-comments"),
vite: {
publicDir: path.resolve(__dirname, "./public"),
plugins: [eslint4b(), vitePluginGetLinter(), viteCommonjs()],
define: {
MONACO_EDITOR_VERSION: JSON.stringify(
require("monaco-editor/package.json").version
),
},
},

lastUpdated: true,
themeConfig: {
search: {
provider: "local",
options: {
detailedView: true,
},
},
editLink: {
pattern:
"https://github.com/eslint-community/eslint-plugin-eslint-comments/edit/main/docs/:path",
},
socialLinks: [
{
icon: "github",
link: "https://github.com/eslint-community/eslint-plugin-eslint-comments",
},
],

nav: [
{ text: "Guide", link: "/" },
{ text: "Rules", link: "/rules/" },
],

sidebar: [
{
items: [
{ text: "Guide", link: "/" },
{ text: "Available Rules", link: "/rules/" },
],
},
...withCategories.map(({ category, rules }) => ({
text: `Rules in ${category}`,
collapsable: false,
items: rules.map((rule) => ({
text: `eslint-comments/${rule.name}`,
link: `/rules/${rule.name}`,
})),
})),
],
},
})
Loading

0 comments on commit 3c08550

Please sign in to comment.