Skip to content

Commit 8039f42

Browse files
sarahdayanulivz
authored andcommitted
docs: documentation linting (#1745)
* chore: install textlint * chore: add textlint rules * feat: set up configuration file and command * fix: run textlint on files * chore: lint .textlintrc.js * chore: add custom terms * chore: add comment filter * fix: fix frontmatter term * chore: set subjective rules to warning severity * fix: manually fix issues * chore: add script as pre-commit hook
1 parent f6a2fb9 commit 8039f42

36 files changed

+1232
-261
lines changed

.lintstagedrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"*.{js,vue}": ["eslint --fix", "git add"]
3+
}

package.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
],
88
"description": "Minimalistic doc generator with Vue component based layout system",
99
"scripts": {
10+
"precommit": "lint-staged",
1011
"bootstrap": "yarn && lerna bootstrap && yarn tsc",
1112
"clean": "lerna clean && rm -rf node_modules",
1213
"boot": "node scripts/bootstrap.js",
@@ -24,25 +25,23 @@
2425
"test": "node scripts/test.js",
2526
"tsc": "lerna run tsc"
2627
},
27-
"gitHooks": {
28-
"pre-commit": "lint-staged"
29-
},
30-
"lint-staged": {
31-
"*.{js,vue}": [
32-
"eslint --fix",
33-
"git add"
34-
]
35-
},
3628
"devDependencies": {
29+
"@types/escape-html": "^0.0.20",
30+
"@types/fs-extra": "^5.0.4",
31+
"@types/globby": "^9.1.0",
32+
"@types/hash-sum": "^1.0.0",
33+
"@types/lru-cache": "^4.1.1",
34+
"@types/node": "^10.12.12",
35+
"@types/semver": "^6.0.0",
3736
"conventional-changelog-cli": "^2.0.21",
3837
"eslint": "^4.19.1",
3938
"eslint-plugin-jest": "^21.15.1",
4039
"eslint-plugin-vue-libs": "^3.0.0",
40+
"husky": "^3.0.2",
41+
"inquirer": "^6.2.0",
4142
"lerna": "3.13.4",
4243
"lint-staged": "^8.1.5",
4344
"minimist": "^1.2.0",
44-
"yorkie": "^2.0.0",
45-
"inquirer": "^6.2.0",
4645
"typescript": "^3.2.2",
4746
"@types/node": "^10.12.12",
4847
"@types/lru-cache": "^4.1.1",

packages/docs/.lintstagedrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"docs/**/*.md": ["yarn lint-md", "git add"]
3+
}

packages/docs/.textlint.terms.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[
2+
"Stylus",
3+
"VuePress",
4+
[
5+
"front[- ]matter",
6+
"frontmatter"
7+
]
8+
]

packages/docs/.textlintrc.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
rules: {
3+
'@textlint-rule/no-unmatched-pair': true,
4+
apostrophe: true,
5+
'common-misspellings': true,
6+
diacritics: true,
7+
'en-capitalization': {
8+
allowHeading: false
9+
},
10+
'stop-words': {
11+
severity: 'warning'
12+
},
13+
terminology: {
14+
terms: `${__dirname}/.textlint.terms.json`
15+
},
16+
'write-good': {
17+
severity: 'warning'
18+
}
19+
},
20+
filters: {
21+
comments: true
22+
}
23+
}

packages/docs/docs/api/cli.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Command Line Interface
1+
# Command-line Interface
22

33
## Usage
44

@@ -40,7 +40,7 @@ See [host](../config/README.md#host).
4040
Open browser when ready.
4141

4242
### --no-clear-screen
43-
do not clear screen when dev server is ready.
43+
Do not clear screen when dev server is ready.
4444

4545
## eject
4646

packages/docs/docs/api/node.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Create a VuePress application.
1414

1515
#### App.prototype.process: () => Promise\<void> | never
1616

17-
A asynchronous method used to prepare the context of the current app. which contains loading pages and plugins, apply plugins, etc.
17+
An asynchronous method used to prepare the context of the current app, and which contains loading pages and plugins, apply plugins, etc.
1818

1919
#### App.prototype.dev: () => Promise\<App> | never
2020

@@ -27,7 +27,7 @@ Launch a build process with current app context.
2727

2828
### dev(\[options]): Promise\<App>
2929

30-
Start a development server, actually it's implemented by `createApp`:
30+
Start a development server, actually its implemented by `createApp`:
3131

3232
```js
3333
async function dev (options) {
@@ -39,7 +39,7 @@ async function dev (options) {
3939

4040
### build(\[options]): Promise\<App>
4141

42-
Build your source files as a static site, actually it's implemented by `createApp`:
42+
Build your source files as a static site, actually its implemented by `createApp`:
4343

4444
```js
4545
async function build (options) {
@@ -96,4 +96,4 @@ See [dest](../config/README.md#dest).
9696
- Type: `object`
9797
- Required: `{}`
9898

99-
It's very useful when you're writing tests and don't want to depend on actual config file, for all options please head [siteConfig](../config/README.md).
99+
It’s useful when youre writing tests and dont want to depend on actual config file, for all options please head [siteConfig](../config/README.md).

packages/docs/docs/config/README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ sidebar: auto
1414
- Type: `string`
1515
- Default: `/`
1616

17-
The base URL the site will be deployed at. You will need to set this if you plan to deploy your site under a sub path, for example, GitHub pages. If you plan to deploy your site to `https://foo.github.io/bar/`, then `base` should be set to `"/bar/"`. It should always start and end with a slash.
17+
The base URL the site will be deployed at. You will need to set this if you plan to deploy your site under a sub path, for example, GitHub pages. If you plan to deploy your site to `https://foo.github.io/bar/`, then you should set `base` to `"/bar/"`. It should always start and end with a slash.
1818

1919
The `base` is automatically prepended to all the URLs that start with `/` in other options, so you only need to specify it once.
2020

@@ -35,14 +35,14 @@ Title for the site. This will be the prefix for all page titles, and displayed i
3535
- Type: `string`
3636
- Default: `undefined`
3737

38-
Description for the site. This will be rendered as a `<meta>` tag in the page HTML.
38+
Description for the site. This will render as a `<meta>` tag in the page HTML.
3939

4040
### head
4141

4242
- Type: `Array`
4343
- Default: `[]`
4444

45-
Extra tags to be injected to the page HTML `<head>`. Each tag can be specified in the form of `[tagName, { attrName: attrValue }, innerHTML?]`. For example, to add a custom favicon:
45+
Extra tags to inject into the page HTML `<head>`. You can specify each tag in the form of `[tagName, { attrName: attrValue }, innerHTML?]`. For example, to add a custom favicon:
4646

4747
``` js
4848
module.exports = {
@@ -102,10 +102,10 @@ A function to control what files should have `<link rel="preload">` resource hin
102102

103103
VuePress uses [cache-loader](https://github.com/webpack-contrib/cache-loader) by default to greatly speed up the compilation of webpack.
104104

105-
This option can be used to specify the path to the cache, and can also remove the cache before each build by setting it to `false`.
105+
You can use this option to specify the path to the cache, and can also remove the cache before each build by setting it to `false`.
106106

107107
::: tip
108-
This option can also be used through the CLI:
108+
You can also use this option through the CLI:
109109

110110
```bash
111111
vuepress dev docs --cache .cache # set cache path
@@ -118,7 +118,7 @@ vuepress dev docs --no-cache # remove cache before each build.
118118
- Type: `Array`
119119
- Default: `[]`
120120

121-
Specify extra files to be watched.
121+
Specify extra files to watch.
122122

123123
You can watch any file if you want. File changes will trigger `vuepress` rebuilding and real-time updates.
124124

@@ -135,9 +135,9 @@ module.exports = {
135135

136136
### palette.styl
137137

138-
If you wish to apply simple color overrides to the styling of the [default preset](https://github.com/vuejs/vuepress/blob/master/packages/@vuepress/core/lib/client/style/config.styl) or define some color variables for using later, you can create an `.vuepress/styles/palette.styl` file.
138+
To apply simple color overrides to the styling of the [default preset](https://github.com/vuejs/vuepress/blob/master/packages/@vuepress/core/lib/client/style/config.styl) or define some color variables for using later, you can create a `.vuepress/styles/palette.styl` file.
139139

140-
There are a few color variables you can tweak:
140+
There are some color variables you can tweak:
141141

142142
``` stylus
143143
// showing default values
@@ -148,12 +148,12 @@ $codeBgColor = #282c34
148148
```
149149

150150
::: danger Note
151-
You should ONLY write color variables in this file. since `palette.styl` will be imported at the end of the root stylus config file, as a config, it will be used by multiple files, so once you wrote styles here, your style would be duplicated by multiple times.
151+
You should ONLY write color variables in this file. Since `palette.styl` will be imported at the end of the root Stylus config file, as a config, several files will use it, so once you wrote styles here, your style would be duplicated by multiple times.
152152
:::
153153

154154
### index.styl
155155

156-
VuePress provides a convenient way to add extra styles. you can create an `.vuepress/styles/index.styl` file for that. This is a [Stylus](http://stylus-lang.com/) file but you can use normal CSS syntax as well.
156+
VuePress provides a convenient way to add extra styles. You can create a `.vuepress/styles/index.styl` file for that. This is a [Stylus](http://stylus-lang.com/) file but you can use normal CSS syntax as well.
157157

158158
```stylus
159159
.content {
@@ -163,7 +163,7 @@ VuePress provides a convenient way to add extra styles. you can create an `.vuep
163163

164164
**Also see:**
165165

166-
- [Why can't `palette.styl` and `index.styl` merge into one API?](../faq/README.md#why-can-t-palette-styl-and-index-styl-merge-into-one-api)
166+
- [Why cant `palette.styl` and `index.styl` merge into one API?](../faq/README.md#why-can-t-palette-styl-and-index-styl-merge-into-one-api)
167167

168168
## Theming
169169

@@ -196,7 +196,7 @@ Provide config options to the used theme. The options will vary depending on the
196196
- Type: `Object|Array`
197197
- Default: `undefined`
198198

199-
Please refer to [Plugin > Using a plugin](../plugin/using-a-plugin.md) to learn how to use a plugin.
199+
Please check out [Plugin > Using a plugin](../plugin/using-a-plugin.md) to learn how to use a plugin.
200200

201201
## Markdown
202202

@@ -223,7 +223,7 @@ Function for transforming [header](../miscellaneous/glossary.md#headers) texts i
223223
- Type: `Object`
224224
- Default: `{ permalink: true, permalinkBefore: true, permalinkSymbol: '#' }`
225225

226-
Options for [markdown-it-anchor](https://github.com/valeriangalliat/markdown-it-anchor). (Note: prefer `markdown.slugify` if you want to customize header ids.)
226+
Options for [markdown-it-anchor](https://github.com/valeriangalliat/markdown-it-anchor). (Note: prefer `markdown.slugify` to customize header ids.)
227227

228228
### markdown.externalLinks
229229

@@ -237,11 +237,11 @@ The key and value pair will be added to `<a>` tags that point to an external lin
237237
- Type: `Object`
238238
- Default: `{ includeLevel: [2, 3] }`
239239

240-
Options for [markdown-it-table-of-contents](https://github.com/Oktavilla/markdown-it-table-of-contents). (Note: prefer `markdown.slugify` if you want to customize header ids.)
240+
Options for [markdown-it-table-of-contents](https://github.com/Oktavilla/markdown-it-table-of-contents). (Note: prefer `markdown.slugify` to customize header ids.)
241241

242242
### markdown.plugins
243243

244-
You can install any markdown-it plugins through `markdown.plugins` option. It is similar with [using VuePress plugins](../plugin/using-a-plugin.html#using-a-plugin). You can either use Babel style or object style. The `markdown-it-` prefix is optional and can omit in the list.
244+
You can install any markdown-it plugins through `markdown.plugins` option. It’s similar with [using VuePress plugins](../plugin/using-a-plugin.html#using-a-plugin). You can either use Babel style or object style. The `markdown-it-` prefix is optional and can omit in the list.
245245

246246
``` js
247247
module.exports = {
@@ -256,7 +256,7 @@ module.exports = {
256256
}
257257
```
258258

259-
or
259+
Or
260260

261261
``` js
262262
module.exports = {
@@ -276,7 +276,7 @@ module.exports = {
276276
- Type: `Function`
277277
- Default: `undefined`
278278

279-
A function to modify default config or apply additional plugins to the [markdown-it](https://github.com/markdown-it/markdown-it) instance used to render source files. e.g.
279+
A function to edit default config or apply extra plugins to the [markdown-it](https://github.com/markdown-it/markdown-it) instance used to render source files. For example:
280280

281281
``` js
282282
module.exports = {
@@ -306,7 +306,7 @@ VuePress comes with built-in webpack config for the CSS pre-processors listed be
306306

307307
Options for [postcss-loader](https://github.com/postcss/postcss-loader). Note specifying this value will overwrite autoprefixer and you will need to include it yourself.
308308

309-
### stylus
309+
### Stylus
310310

311311
- Type: `Object`
312312
- Default: `{ preferPathResolver: 'webpack' }`
@@ -320,7 +320,7 @@ Options for [stylus-loader](https://github.com/shama/stylus-loader).
320320

321321
Options for [sass-loader](https://github.com/webpack-contrib/sass-loader) to load `*.scss` files.
322322

323-
### sass
323+
### Sass
324324

325325
- Type: `Object`
326326
- Default: `{ indentedSyntax: true }`
@@ -339,7 +339,7 @@ Options for [less-loader](https://github.com/webpack-contrib/less-loader).
339339
- Type: `Object | Function`
340340
- Default: `undefined`
341341

342-
Modify the internal webpack config. If the value is an Object, it will be merged into the final config using [webpack-merge](https://github.com/survivejs/webpack-merge); If the value is a function, it will receive the config as the 1st argument and an `isServer` flag as the 2nd argument. You can either mutate the config directly, or return an object to be merged:
342+
Edit the internal webpack config. If the value is an Object, it will be merged into the final config using [webpack-merge](https://github.com/survivejs/webpack-merge); If the value is a function, it will receive the config as the 1st argument and an `isServer` flag as the 2nd argument. You can either mutate the config directly, or return an object to merge:
343343

344344
``` js
345345
module.exports = {
@@ -356,7 +356,7 @@ module.exports = {
356356
- Type: `Function`
357357
- Default: `undefined`
358358

359-
Modify the internal webpack config with [webpack-chain](https://github.com/mozilla-neutrino/webpack-chain).
359+
Edit the internal webpack config with [webpack-chain](https://github.com/mozilla-neutrino/webpack-chain).
360360

361361
``` js
362362
module.exports = {

packages/docs/docs/faq/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ sidebar: auto
44

55
# FAQ
66

7-
## Why can't `palette.styl` and `index.styl` merge into one API?
7+
## Why cant `palette.styl` and `index.styl` merge into one API?
88

9-
The `palette.styl` is responsible for global color settings. During compilation, theme color constants should be resolved by the preprocessor first and then be applied to the global context.
9+
The `palette.styl` is responsible for global color settings. During compilation, theme color constants should be resolved by the preprocessor first and then be applied to the global context.
1010

11-
But for `index.styl`. its job is to override the default styles of application. According to the priority principle of css, the later style has a higher priority, so it should be generated at the end of the CSS file.
11+
But for `index.styl`, its job is to override the default styles of application. According to the priority principle of CSS, the later style has a higher priority, so it should be generated at the end of the CSS file.
1212

13-
A simple diagram describing the stylus compiler's compilation order as follows:
13+
A simple diagram describing the Stylus compilers compilation order as follows:
1414

1515
@flowstart
1616
stage1=>operation: palette.styl
@@ -22,11 +22,11 @@ stage1->stage2->stage3
2222

2323
<br>
2424

25-
## What's the differences between the `clientDynamicModules` and `enhanceAppFiles`?
25+
## Whats the differences between the `clientDynamicModules` and `enhanceAppFiles`?
2626

27-
Let's take a look back first, both `clientDynamicModules` and `enhanceAppFiles` can generate modules with dynamic javascript code during compile time.
27+
Lets take a look back first, both `clientDynamicModules` and `enhanceAppFiles` can generate modules with dynamic JavaScript code during compile time.
2828

29-
The difference is that the files generated by `enhanceAppFiles` will be loaded and applied automatically when the application is initialized on the client side. While the files generated by `clientDynamicModules` needs to be imported as `@dynamic/xxx` by the users themselves.
29+
The difference is that the files generated by `enhanceAppFiles` will be loaded and applied automatically when the application is initialized on the client-side, while the files generated by `clientDynamicModules` need to be imported as `@dynamic/xxx` by the users themselves.
3030

3131
```js
3232
module.exports = (options, ctx) => ({
@@ -48,12 +48,12 @@ module.exports = (options, ctx) => ({
4848

4949
## When do I need to use `enhanceAppFiles`?
5050

51-
1. I want to execute some code on the client side automatically.
52-
2. I don't have a need for reuse of this module.
51+
1. I want to execute some code on the client-side automatically.
52+
2. I don’t need to reuse this module.
5353

5454
**Example:**
5555

56-
- [@vuepress/plugin-register-components](https://github.com/vuejs/vuepress/tree/master/packages/@vuepress/plugin-register-components/index.js#L24): Automatically registering components on the client side.
56+
- [@vuepress/plugin-register-components](https://github.com/vuejs/vuepress/tree/master/packages/@vuepress/plugin-register-components/index.js#L24): Automatically registering components on the client-side.
5757
- [@vuepress/plugin-pagination](https://github.com/vuejs/vuepress/blob/master/packages/@vuepress/plugin-pagination/index.js#L14): Automatically insert Vue plugins to expand the API of the client.
5858

5959
## When do I need to use `clientDynamicModules`?
@@ -63,5 +63,5 @@ module.exports = (options, ctx) => ({
6363

6464
**Example:**
6565

66-
- [@vuepress/plugin-blog](https://github.com/ulivz/vuepress-plugin-blog/blob/master/src/index.ts#L167): Using compile-time metadata to generate some dynamic blog-related modules and initialize them on the client side by using `enhanceAppFiles`.
66+
- [@vuepress/plugin-blog](https://github.com/ulivz/vuepress-plugin-blog/blob/master/src/index.ts#L167): Using compile-time metadata to generate some dynamic blog-related modules and initialize them on the client-side by using `enhanceAppFiles`.
6767

0 commit comments

Comments
 (0)