Skip to content

Commit a9bd87a

Browse files
committed
Docs: add vuepress site
1 parent 7977c85 commit a9bd87a

31 files changed

+393
-211
lines changed

.eslintignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1+
/.nyc_output
2+
/coverage
13
/node_modules
2-
!.eslintrc.js
4+
5+
!.vuepress
6+
/docs/.vuepress/dist

.eslintrc.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

.eslintrc.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
extends:
2+
- plugin:mysticatea/es2015
3+
- plugin:mysticatea/+eslint-plugin
4+
5+
overrides:
6+
- files: "docs/.vuepress/components/*.vue"
7+
parserOptions:
8+
parser: babel-eslint
9+
10+
- files: "lib/rules/*.js"
11+
rules:
12+
mysticatea/eslint-plugin/require-meta-docs-url:
13+
- error
14+
- pattern: "https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/{{name}}.html"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/.nyc_output
22
/.vscode
33
/coverage
4+
/docs/.vuepress/dist
45
/node_modules
56
/npm-debug.log
67
/test.js

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,17 @@ script:
1818

1919
after_success:
2020
- npm run codecov
21+
22+
before_deploy:
23+
- npm run docs:build
24+
25+
deploy:
26+
provider: pages
27+
github-token: $ATOKEN
28+
keep-history: true
29+
local-dir: docs/.vuepress/dist
30+
on:
31+
branch: master
32+
node: "10"
33+
condition: $ESLINT_VERSION = ^4.19.1
34+
skip-cleanup: true

README.md

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -8,74 +8,9 @@
88

99
Additional ESLint rules for ESLint directive comments (e.g. `//eslint-disable-line`).
1010

11-
## 💿 Installation
12-
13-
```
14-
npm install --save-dev eslint eslint-plugin-eslint-comments
15-
```
16-
17-
### Requirements
18-
19-
- Node.js `^6.5.0`, or newer versions.
20-
- ESLint `^4.19.1`, or newer versions.
21-
2211
## 📖 Usage
2312

24-
Write in your ESLint configurations: http://eslint.org/docs/user-guide/configuring#using-the-configuration-from-a-plugin
25-
26-
### Example
27-
28-
**.eslintrc.json**
29-
30-
```json
31-
{
32-
"extends": [
33-
"eslint:recommended",
34-
"plugin:eslint-comments/recommended"
35-
],
36-
}
37-
```
38-
39-
Or you can specify for each rule:
40-
41-
```json
42-
{
43-
"plugins": [
44-
"eslint-comments"
45-
],
46-
"rules": {
47-
"eslint-comments/no-unused-disable": "error",
48-
"eslint-comments/no-unused-enable": "error",
49-
// ...
50-
}
51-
}
52-
```
53-
54-
## Rules
55-
56-
- 🌟 mark: the rule is enabled by `eslint-comments/recommended` preset.
57-
- ✒️ mark: the rule is fixable by `eslint --fix` command.
58-
59-
<!--RULES_TABLE_START-->
60-
### Best Practices
61-
62-
| | Rule ID | Description |
63-
|:---|:--------|:------------|
64-
| 🌟 | [eslint-comments/disable-enable-pair](./docs/rules/disable-enable-pair.md) | requires a `eslint-enable` comment for every `eslint-disable` comment |
65-
| 🌟 | [eslint-comments/no-aggregating-enable](./docs/rules/no-aggregating-enable.md) | disallows `eslint-enable` comments for multiple `eslint-disable` comments |
66-
| 🌟 | [eslint-comments/no-duplicate-disable](./docs/rules/no-duplicate-disable.md) | disallows duplicate `eslint-disable` comments |
67-
| 🌟 | [eslint-comments/no-unlimited-disable](./docs/rules/no-unlimited-disable.md) | disallows `eslint-disable` comments without rule names |
68-
| | [eslint-comments/no-unused-disable](./docs/rules/no-unused-disable.md) | disallows unused `eslint-disable` comments |
69-
| 🌟 | [eslint-comments/no-unused-enable](./docs/rules/no-unused-enable.md) | disallows unused `eslint-enable` comments |
70-
71-
### Stylistic Issues
72-
73-
| | Rule ID | Description |
74-
|:---|:--------|:------------|
75-
| | [eslint-comments/no-restricted-disable](./docs/rules/no-restricted-disable.md) | disallows `eslint-disable` comments about specific rules |
76-
| | [eslint-comments/no-use](./docs/rules/no-use.md) | disallows ESLint directive-comments |
77-
78-
<!--RULES_TABLE_END-->
13+
- [Documentation](https://mysticatea.github.io/eslint-plugin-eslint-comments)
7914

8015
## 🚥 Semantic Versioning Policy
8116

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<template>
2+
<eslint-editor
3+
:linter="linter"
4+
:config="config"
5+
:code="code"
6+
:class="`eslint-playground-${type}`"
7+
class="eslint-playground"
8+
dark
9+
fix
10+
/>
11+
</template>
12+
13+
<script>
14+
// https://github.com/vuejs/vuepress/issues/451
15+
import EslintEditor from "../../../node_modules/vue-eslint-editor"
16+
import { rules } from "../../../"
17+
18+
export default {
19+
name: "ESLintPlayground",
20+
components: { EslintEditor },
21+
22+
props: {
23+
code: {
24+
type: String,
25+
required: true,
26+
},
27+
type: {
28+
type: String,
29+
required: true,
30+
validator(value) {
31+
return value === "bad" || value === "good"
32+
},
33+
},
34+
reportUnusedDisable: {
35+
type: Boolean,
36+
default: false,
37+
},
38+
},
39+
40+
data() {
41+
return {
42+
linter: null,
43+
}
44+
},
45+
46+
computed: {
47+
config() {
48+
const config = {
49+
globals: {
50+
// ES2015 globals
51+
ArrayBuffer: false,
52+
DataView: false,
53+
Float32Array: false,
54+
Float64Array: false,
55+
Int16Array: false,
56+
Int32Array: false,
57+
Int8Array: false,
58+
Map: false,
59+
Promise: false,
60+
Proxy: false,
61+
Reflect: false,
62+
Set: false,
63+
Symbol: false,
64+
Uint16Array: false,
65+
Uint32Array: false,
66+
Uint8Array: false,
67+
Uint8ClampedArray: false,
68+
WeakMap: false,
69+
WeakSet: false,
70+
// ES2017 globals
71+
Atomics: false,
72+
SharedArrayBuffer: false,
73+
},
74+
rules: {},
75+
parserOptions: {
76+
ecmaVersion: 2018,
77+
sourceType: "module",
78+
},
79+
}
80+
81+
if (this.reportUnusedDisable) {
82+
config.rules["eslint-comments/no-unused-disable"] = "error"
83+
}
84+
85+
return config
86+
},
87+
},
88+
89+
async mounted() {
90+
// Load linter.
91+
const { default: Linter } = await import("eslint4b")
92+
const linter = (this.linter = new Linter())
93+
94+
for (const ruleId of Object.keys(rules)) {
95+
linter.defineRule(`eslint-comments/${ruleId}`, rules[ruleId])
96+
}
97+
},
98+
}
99+
</script>
100+
101+
<style>
102+
.eslint-playground {
103+
width: 100%;
104+
min-height: 160px;
105+
margin-bottom: 8px;
106+
box-sizing: border-box;
107+
border: 1.5px solid gray;
108+
}
109+
.eslint-playground-good {
110+
border-color: #4caf50;
111+
}
112+
.eslint-playground-bad {
113+
border-color: #f44336;
114+
}
115+
</style>

docs/.vuepress/config.js

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/**
2+
* @author Toru Nagashima <https://github.com/mysticatea>
3+
* See LICENSE file in root directory for full license.
4+
*/
5+
"use strict"
6+
7+
const rules = require("../../scripts/lib/rules")
8+
require("../../scripts/update-docs-headers")
9+
require("../../scripts/update-docs-index")
10+
11+
module.exports = {
12+
base: "/eslint-plugin-eslint-comments/",
13+
title: "eslint-plugin-eslint-comments",
14+
description: "ESLint plugin about ECMAScript syntax.",
15+
serviceWorker: true,
16+
ga: "UA-12936571-6",
17+
evergreen: true,
18+
19+
themeConfig: {
20+
repo: "mysticatea/eslint-plugin-eslint-comments",
21+
docsRepo: "mysticatea/eslint-plugin-eslint-comments",
22+
docsDir: "docs",
23+
docsBranch: "master",
24+
editLinks: true,
25+
lastUpdated: true,
26+
serviceWorker: {
27+
updatePopup: true,
28+
},
29+
30+
nav: [
31+
{ text: "Guide", link: "/guide/getting-started" },
32+
{ text: "Rules", link: "/rules/" },
33+
],
34+
35+
sidebarDepth: 0,
36+
sidebar: [
37+
{
38+
title: "Guide",
39+
collapsable: false,
40+
children: ["/", "/guide/getting-started"],
41+
},
42+
{
43+
title: "Rules",
44+
collapsable: false,
45+
children: [
46+
"/rules/",
47+
...rules.map(({ id, name }) => [`/rules/${name}`, id]),
48+
],
49+
},
50+
],
51+
},
52+
53+
configureWebpack: {
54+
module: {
55+
rules: [
56+
{
57+
test: new RegExp(String.raw`internal[\\/]get-linters\.js$`),
58+
loader: "string-replace-loader",
59+
options: {
60+
search: "[\\s\\S]+", // whole file.
61+
replace:
62+
'module.exports = () => [require("eslint4b/dist/linter")]',
63+
flags: "g",
64+
},
65+
},
66+
],
67+
},
68+
},
69+
}

docs/.vuepress/override.styl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
$accentColor = #463fd4

docs/.vuepress/public/.nojekyll

Whitespace-only changes.

0 commit comments

Comments
 (0)