Skip to content

Commit d4c6d71

Browse files
Lehoczkyvhoyer
authored andcommitted
docs: create vitepress site
1 parent 69e13f6 commit d4c6d71

36 files changed

+1335
-413
lines changed

Diff for: .github/workflows/docs.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Docs
2+
3+
on:
4+
workflow_dispatch: {}
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
docs:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: 18
20+
cache: yarn
21+
22+
- name: Install dependencies
23+
run: yarn install --frozen-lockfile
24+
25+
- name: Build docs
26+
run: npm run docs:build
27+
28+
# https://github.com/crazy-max/ghaction-github-pages
29+
- name: Deploy to GitHub Pages
30+
uses: crazy-max/ghaction-github-pages@v3
31+
with:
32+
target_branch: gh-pages
33+
build_dir: docs/.vitepress/dist
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Diff for: .github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@master
1515
- uses: actions/setup-node@v3
1616
with:
17-
node-version: 14.x
17+
node-version: 18
1818
cache: yarn
1919
- name: Lint and test
2020
run: |

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33
/.idea/
44
/dist/
55
/node_modules/
6+
/docs/.vitepress/dist
7+
/docs/.vitepress/cache
8+
yarn-error.log

Diff for: README.md

+7-45
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,15 @@
55

66
An `eslint` plugin for checking accessibility rules from within `.vue` files.
77

8-
## Installation
8+
## 📚 Documentation
99

10-
If you're using `yarn`:
10+
Please refer to the [official website](https://vue-a11y.github.io/eslint-plugin-vuejs-accessibility/).
1111

12-
```bash
13-
yarn add --dev eslint-plugin-vuejs-accessibility
14-
```
15-
16-
or if you're using `npm`:
17-
18-
```bash
19-
npm install --save-dev eslint-plugin-vuejs-accessibility
20-
```
21-
22-
## Usage
23-
24-
Add `vuejs-accessibility` to the plugins section of your `eslint` configuration. You can omit the `eslint-plugin-` prefix:
25-
26-
```json
27-
{
28-
"plugins": ["vuejs-accessibility"]
29-
}
30-
```
31-
32-
Then configure the rules you want to use under the rules section.
33-
34-
```json
35-
{
36-
"rules": {
37-
"vuejs-accessibility/rule-name": "error"
38-
}
39-
}
40-
```
41-
42-
You can also enable all the recommended rules at once. Add `plugin:vuejs-accessibility/recommended` in extends:
43-
44-
```json
45-
{
46-
"extends": ["plugin:vuejs-accessibility/recommended"]
47-
}
48-
```
49-
50-
## Development
12+
## 💻 Development
5113

5214
Ensure you have `node` and `yarn` installed on your system. Then run `yarn` in the root of the repository to install the dependencies.
5315

54-
### Adding a new rule
16+
### 🔧 Adding a new rule
5517

5618
To add a new rule, you need to take the following steps:
5719

@@ -60,15 +22,15 @@ To add a new rule, you need to take the following steps:
6022
- Add the corresponding test in `src/rules/__tests__`.
6123
- Add the corresponding documentation in `docs/rules`.
6224

63-
## Contributing
25+
## 👨‍💻 Contributing
6426

6527
Bug reports and pull requests are welcome on GitHub at https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility.
6628

67-
## License
29+
## 📄 License
6830

6931
The code is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
7032

71-
## Credit
33+
## 🏆 Credit
7234

7335
The work for this plugin was largely based on previous work done on [eslint-plugin-vue-a11y](https://github.com/maranran/eslint-plugin-vue-a11y), as well as various other tools, including:
7436

Diff for: docs/.vitepress/config.ts

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { defineConfig } from "vitepress";
2+
import { rules } from "./rulesForSidebar";
3+
import { description, version } from "../../package.json";
4+
5+
// https://vitepress.dev/reference/site-config
6+
export default defineConfig({
7+
title: "eslint-plugin-vuejs-a11y",
8+
base: "/eslint-plugin-vuejs-accessibility/",
9+
description,
10+
themeConfig: {
11+
// https://vitepress.dev/reference/default-theme-config
12+
nav: [
13+
{
14+
text: version,
15+
items: [
16+
{
17+
text: "Changelog",
18+
link: "https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility/blob/main/CHANGELOG.md"
19+
}
20+
]
21+
}
22+
],
23+
24+
sidebar: [
25+
{
26+
text: "Introduction",
27+
items: [
28+
{ text: "Getting Started", link: "/" },
29+
{ text: "Rule Overview", link: "/rule-overview/index" }
30+
]
31+
},
32+
{
33+
text: "Rules",
34+
items: rules
35+
}
36+
],
37+
38+
editLink: {
39+
pattern:
40+
"https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility/edit/master/docs/:path"
41+
},
42+
43+
socialLinks: [
44+
{
45+
icon: "github",
46+
link: "https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility"
47+
}
48+
],
49+
50+
search: {
51+
provider: "local"
52+
}
53+
}
54+
});

Diff for: docs/.vitepress/rulesForSidebar.ts

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { join, parse } from "node:path";
2+
import { Dirent, readdirSync } from "node:fs";
3+
4+
export const rules = getRulesForSideBar();
5+
6+
function getRulesForSideBar() {
7+
const rulesDirectory = join(__dirname, "../", "rules");
8+
return readdirSync(rulesDirectory, { withFileTypes: true })
9+
.filter(isFile)
10+
.filter(isMarkdown)
11+
.map(fileNameWithoutExtension)
12+
.map(ruleToSidebarItem);
13+
}
14+
15+
function isFile(dirent: Dirent) {
16+
return !dirent.isDirectory();
17+
}
18+
19+
function isMarkdown(dirent: Dirent) {
20+
return dirent.name.endsWith(".md");
21+
}
22+
23+
function fileNameWithoutExtension(file: Dirent) {
24+
const parsedFileName = parse(file.name);
25+
const nameWithoutExtension = parsedFileName.name;
26+
return nameWithoutExtension;
27+
}
28+
29+
function ruleToSidebarItem(ruleName: string) {
30+
return {
31+
text: ruleName,
32+
link: `/rules/${ruleName}`
33+
};
34+
}

Diff for: docs/aria-role.md

-43
This file was deleted.

Diff for: docs/iframe-has-title.md

-25
This file was deleted.

Diff for: docs/index.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Getting Started
2+
3+
An `eslint` plugin for checking accessibility rules from within `.vue` files.
4+
5+
## 💿 Installation
6+
7+
::: code-group
8+
9+
```bash [yarn]
10+
yarn add --dev eslint-plugin-vuejs-accessibility
11+
```
12+
13+
```bash [npm]
14+
npm install --save-dev eslint-plugin-vuejs-accessibility
15+
```
16+
17+
```bash [pnpm]
18+
pnpm add -D eslint-plugin-vuejs-accessibility
19+
```
20+
21+
:::
22+
23+
## 📖 Usage
24+
25+
Add `vuejs-accessibility` to the plugins section of your `eslint` configuration. You can omit the `eslint-plugin-` prefix:
26+
27+
```json
28+
{
29+
"plugins": ["vuejs-accessibility"]
30+
}
31+
```
32+
33+
Then configure the rules you want to use under the rules section.
34+
35+
```json
36+
{
37+
"rules": {
38+
"vuejs-accessibility/rule-name": "error"
39+
}
40+
}
41+
```
42+
43+
You can also enable all the recommended rules at once. Add `plugin:vuejs-accessibility/recommended` in extends:
44+
45+
```json
46+
{
47+
"extends": ["plugin:vuejs-accessibility/recommended"]
48+
}
49+
```

Diff for: docs/rule-overview/RuleTable.vue

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<script setup lang="ts">
2+
import { data as rules } from "./rule-overview.data";
3+
</script>
4+
5+
<template>
6+
<div class="rule-table-container">
7+
<div>✅ - Recommended</div>
8+
9+
<table>
10+
<tr>
11+
<th>Rule</th>
12+
<th></th>
13+
</tr>
14+
15+
<tr v-for="{ name, link, recommended } of rules">
16+
<td>
17+
<a :href="link">{{ name }}</a>
18+
</td>
19+
20+
<td v-if="recommended">✅</td>
21+
<td v-else></td>
22+
</tr>
23+
</table>
24+
</div>
25+
</template>
26+
27+
<style scoped>
28+
.rule-table-container {
29+
margin-top: 24px;
30+
}
31+
32+
table {
33+
width: 100%;
34+
display: table;
35+
}
36+
37+
td:last-of-type {
38+
width: 50px;
39+
}
40+
</style>

Diff for: docs/rule-overview/index.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
prev:
3+
text: Getting Started
4+
link: /
5+
next:
6+
text: alt-text
7+
link: /rules/alt-text
8+
---
9+
10+
<script setup lang="ts">
11+
import RuleTable from './RuleTable.vue'
12+
</script>
13+
14+
# Rule Overview
15+
16+
<RuleTable />

0 commit comments

Comments
 (0)