|
| 1 | +"use strict" |
| 2 | + |
| 3 | +const { defineConfig } = require("vitepress") |
| 4 | +const path = require("path") |
| 5 | + |
| 6 | +const { categories } = require("../../scripts/rules.js") |
| 7 | +const { viteCommonjs, vitePluginRequireResolve } = require("./vite-plugin") |
| 8 | +const { default: eslint4b } = require("vite-plugin-eslint4b") |
| 9 | + |
| 10 | +module.exports = defineConfig({ |
| 11 | + title: "eslint-plugin-es-x", |
| 12 | + base: "/eslint-plugin-es-x/", |
| 13 | + description: "ESLint plugin about ECMAScript syntax.", |
| 14 | + head: [["link", { rel: "icon", href: "/favicon.png" }]], |
| 15 | + |
| 16 | + outDir: path.resolve(__dirname, "./dist/eslint-plugin-es-x"), |
| 17 | + vite: { |
| 18 | + publicDir: path.resolve(__dirname, "./public"), |
| 19 | + plugins: [eslint4b(), vitePluginRequireResolve(), viteCommonjs()], |
| 20 | + define: { |
| 21 | + MONACO_EDITOR_VERSION: JSON.stringify( |
| 22 | + require("monaco-editor/package.json").version, |
| 23 | + ), |
| 24 | + }, |
| 25 | + }, |
| 26 | + |
| 27 | + lastUpdated: true, |
| 28 | + themeConfig: { |
| 29 | + editLink: { |
| 30 | + pattern: |
| 31 | + "https://github.com/eslint-community/eslint-plugin-es-x/edit/master/docs/:path", |
| 32 | + }, |
| 33 | + socialLinks: [ |
| 34 | + { |
| 35 | + icon: "github", |
| 36 | + link: "https://github.com/eslint-community/eslint-plugin-es-x", |
| 37 | + }, |
| 38 | + ], |
| 39 | + |
| 40 | + nav: [ |
| 41 | + { text: "Guide", link: "/" }, |
| 42 | + { text: "Rules", link: "/rules/" }, |
| 43 | + ], |
| 44 | + |
| 45 | + sidebar: [ |
| 46 | + { |
| 47 | + items: [ |
| 48 | + { text: "Guide", link: "/" }, |
| 49 | + { text: "Available Rules", link: "/rules/" }, |
| 50 | + ], |
| 51 | + }, |
| 52 | + ...Object.values(categories) |
| 53 | + .filter((menu) => menu.rules.length) |
| 54 | + .map((category) => ({ |
| 55 | + text: category.title, |
| 56 | + items: category.rules.map(({ ruleId }) => ({ |
| 57 | + text: `es-x/${ruleId}`, |
| 58 | + link: `/rules/${ruleId}`, |
| 59 | + })), |
| 60 | + })), |
| 61 | + ], |
| 62 | + }, |
| 63 | +}) |
0 commit comments