Skip to content

Commit b35ad0b

Browse files
committed
📝 update documents
1 parent f625cd6 commit b35ad0b

18 files changed

+104
-78
lines changed

docs/.vuepress/components/eslint-playground.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
:config="config"
55
:code="code"
66
:class="`eslint-playground-${type}`"
7+
:style="{ height }"
78
class="eslint-playground"
89
dark
910
fix
@@ -84,11 +85,16 @@ export default {
8485
8586
return config
8687
},
88+
89+
height() {
90+
const numLines = this.code.split("\n").length
91+
return `${numLines * 20 + 10}px`
92+
}
8793
},
8894
8995
async mounted() {
9096
// Load linter.
91-
const { default: Linter } = await import("eslint4b/dist/linter")
97+
const { default: Linter } = await import("eslint4b")
9298
const linter = (this.linter = new Linter())
9399
94100
for (const ruleId of Object.keys(rules)) {
@@ -101,10 +107,10 @@ export default {
101107
<style>
102108
.eslint-playground {
103109
width: 100%;
104-
min-height: 160px;
105110
margin-bottom: 8px;
106111
box-sizing: border-box;
107-
border: 1.5px solid gray;
112+
border: 2px solid gray;
113+
border-radius: 3px;
108114
}
109115
.eslint-playground-good {
110116
border-color: #4caf50;

docs/.vuepress/config.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/**
2-
* @author Toru Nagashima <https://github.com/mysticatea>
3-
* See LICENSE file in root directory for full license.
4-
*/
51
"use strict"
62

73
const { withCategories } = require("../../scripts/lib/rules")
@@ -11,9 +7,7 @@ require("../../scripts/update-docs-index")
117
module.exports = {
128
base: "/eslint-plugin-eslint-comments/",
139
title: "eslint-plugin-eslint-comments",
14-
description: "ESLint plugin about ECMAScript syntax.",
15-
serviceWorker: true,
16-
ga: "UA-12936571-6",
10+
description: "Additional ESLint rules for ESLint directive comments.",
1711
evergreen: true,
1812

1913
themeConfig: {
@@ -22,27 +16,33 @@ module.exports = {
2216
docsDir: "docs",
2317
docsBranch: "master",
2418
editLinks: true,
25-
lastUpdated: true,
26-
serviceWorker: {
27-
updatePopup: true,
28-
},
19+
search: false,
2920

30-
nav: [{ text: "Guide", link: "/" }, { text: "Rules", link: "/rules/" }],
21+
nav: [
22+
{
23+
text: "Changelog",
24+
link:
25+
"https://github.com/mysticatea/eslint-plugin-eslint-comments/releases",
26+
},
27+
],
3128

3229
sidebarDepth: 0,
3330
sidebar: {
34-
"/rules/": [
31+
"/": [
32+
"/",
3533
"/rules/",
3634
...withCategories.map(({ category, rules }) => ({
37-
title: category,
35+
title: `Rules in ${category}`,
3836
collapsable: false,
39-
children: rules.map(rule => [
40-
`/rules/${rule.name}`,
41-
rule.id,
42-
]),
37+
children: rules.map(rule => `/rules/${rule.name}`),
4338
})),
4439
],
45-
"/": ["/", "/getting-started", "/rules/"],
40+
},
41+
42+
plugins: {
43+
"@vuepress/google-analytics": { ga: "UA-12936571-6" },
44+
"@vuepress/last-updated": {},
45+
"@vuepress/pwa": { updatePopup: true },
4646
},
4747
},
4848

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
$accentColor = #463fd4
2-
31
table a
42
white-space nowrap

docs/.vuepress/styles/palette.styl

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

docs/README.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Introduction
1+
# Getting Started
22

33
[![npm version](https://img.shields.io/npm/v/eslint-plugin-eslint-comments.svg)](https://www.npmjs.com/package/eslint-plugin-eslint-comments)
44
[![Downloads/month](https://img.shields.io/npm/dm/eslint-plugin-eslint-comments.svg)](http://www.npmtrends.com/eslint-plugin-eslint-comments)
@@ -10,10 +10,47 @@ Additional ESLint rules for ESLint directive comments (e.g. `//eslint-disable-li
1010

1111
## 🏁 Goal
1212

13-
The purpose of this plugin is to apply best practices on directive comments like `/* eslint-disable */`.
13+
The purpose of this plugin is to apply best practices on directive comments such as `/* eslint-disable */`.
1414

1515
For example,
1616

1717
- to disallow unused disabling.
1818
- to disallow non-effect enabling.
1919
- to require rule IDs for disabling and enabling.
20+
21+
## 💿 Installation
22+
23+
Use [npm](https://www.npmjs.com/) or a compatible tool.
24+
25+
```console
26+
npm install --save-dev eslint eslint-plugin-eslint-comments
27+
```
28+
29+
::: tip Requirements
30+
- Node.js `6.5.0` or newer.
31+
- ESLint `4.19.1` or newer.
32+
:::
33+
34+
## 📖 Usage
35+
36+
Configure your `.eslintrc.*` file.
37+
38+
For example:
39+
40+
```jsonc
41+
{
42+
"extends": [
43+
"eslint:recommended",
44+
"plugin:eslint-comments/recommended"
45+
],
46+
"rules": {
47+
// Optional.
48+
"eslint-comments/no-unused-disable": "error"
49+
}
50+
}
51+
```
52+
53+
::: tip
54+
The [eslint-comments/no-unused-disable](./rules/no-unused-disable.html) rule has the same effect as [--report-unused-disable-directives](https://eslint.org/docs/user-guide/command-line-interface#--report-unused-disable-directives) option.
55+
However, the `eslint-comments/no-unused-disable` rule is relatively useful since it can be configured in shareable configs.
56+
:::

docs/getting-started.md

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

docs/rules/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# All Rules
1+
# Available Rules
22

33
- 🌟 mark: the rule which is enabled by `eslint-comments/recommended` preset.
44
- ✒️ mark: the rule which is fixable by `eslint --fix` command.
@@ -11,7 +11,7 @@
1111
| [eslint-comments/<wbr>no-aggregating-enable](./no-aggregating-enable.html) | disallow a `eslint-enable` comment for multiple `eslint-disable` comments | 🌟 |
1212
| [eslint-comments/<wbr>no-duplicate-disable](./no-duplicate-disable.html) | disallow duplicate `eslint-disable` comments | 🌟 |
1313
| [eslint-comments/<wbr>no-unlimited-disable](./no-unlimited-disable.html) | disallow `eslint-disable` comments without rule names | 🌟 |
14-
| [eslint-comments/<wbr>no-unused-disable](./no-unused-disable.html) | disallow unused `eslint-disable` comments | |
14+
| [eslint-comments/<wbr>no-unused-disable](./no-unused-disable.html) | disallow unused `eslint-disable` comments | ✒️ |
1515
| [eslint-comments/<wbr>no-unused-enable](./no-unused-enable.html) | disallow unused `eslint-enable` comments | 🌟 |
1616

1717
## Stylistic Issues

docs/rules/disable-enable-pair.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# require a `eslint-enable` comment for every `eslint-disable` comment (eslint-comments/disable-enable-pair)
1+
# eslint-comments/disable-enable-pair
2+
3+
> require a `eslint-enable` comment for every `eslint-disable` comment
24
35
- 🌟 The `"extends": "plugin:eslint-comments/recommended"` property in a configuration file enables this rule.
46

docs/rules/no-aggregating-enable.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
# disallow a `eslint-enable` comment for multiple `eslint-disable` comments (eslint-comments/no-aggregating-enable)
1+
# eslint-comments/no-aggregating-enable
2+
3+
> disallow a `eslint-enable` comment for multiple `eslint-disable` comments
24
35
- 🌟 The `"extends": "plugin:eslint-comments/recommended"` property in a configuration file enables this rule.
46

57
`eslint-enable` directive-comments can enable rules which are disabled by different `eslint-disable` directive-comments.
68
It can enable a rule unintentionally.
79

810
```js
11+
/*eslint-disable no-undef */
912
f()
1013
/*eslint-disable no-var */
1114
var a

docs/rules/no-duplicate-disable.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# disallow duplicate `eslint-disable` comments (eslint-comments/no-duplicate-disable)
1+
# eslint-comments/no-duplicate-disable
2+
3+
> disallow duplicate `eslint-disable` comments
24
35
- 🌟 The `"extends": "plugin:eslint-comments/recommended"` property in a configuration file enables this rule.
46

0 commit comments

Comments
 (0)