Skip to content

chore(docs): use vitepress #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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