Skip to content

Commit

Permalink
ci(markdownlint): Configure and setup markdownlint as lint tools (#31)
Browse files Browse the repository at this point in the history
* ci(markdownlint): 配置和支持对 Markdown 文件的 lint

* ci(markdownlint): 配置 nano-staged 和 package.json 中的 scripts

* ci(markdownlint): 移除多余的配置

* ci(markdownlint): 移除多余的配置

* ci(markdownlint): 修复 lint
  • Loading branch information
nekomeowww authored Jun 5, 2022
1 parent 1421468 commit eece5d6
Show file tree
Hide file tree
Showing 9 changed files with 156 additions and 95 deletions.
36 changes: 36 additions & 0 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
// Example markdownlint JSON(C) configuration with all properties set to their default value
// Default state for all rules
"default": true,

// Path to configuration file to extend
"extends": null,

// MD013/line-length - Line length
"MD013": {
// Number of characters
"line_length": -1,
// Number of characters for headings
"heading_line_length": 150,
// Number of characters for code blocks
"code_block_line_length": 150,
// Include code blocks
"code_blocks": true,
// Include tables
"tables": false,
// Include headings
"headings": true,
// Include headings
"headers": true,
// Strict length checking
"strict": false,
// Stern length checking
"stern": false
},

// MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading
"MD041": false,

// MD033/no-inline-html - Inline HTML
"MD033": false
}
2 changes: 2 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CHANGELOG.md
node_modules
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "dprint.dprint"]
"recommendations": ["dbaeumer.vscode-eslint", "dprint.dprint", "DavidAnson.vscode-markdownlint"]
}
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ SlimeForm is a form state management and validator which is **dependency free**,
- [ ] Support `validate` (Async)
- [ ] 💡 More ideas...

**Contributions are welcomed**
### Contributions are welcomed

## Try it online

Expand All @@ -63,7 +63,7 @@ SlimeForm is a form state management and validator which is **dependency free**,

> ⚗️ **Experimental**
```
```shell
npm i slimeform
```

Expand Down Expand Up @@ -307,7 +307,7 @@ SlimeForm has a built-in resolvers for [Yup](https://github.com/jquense/yup) syn
**First, you have to install [Yup](https://github.com/jquense/yup)**

```sh
$ npm install yup
npm install yup
```

then import `yup` and `yupFieldRule` into your code and you're ready to go!
Expand Down Expand Up @@ -362,4 +362,3 @@ Some suggestions:
</form>
</template>
```

7 changes: 4 additions & 3 deletions README.zh-Hans.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ SlimeForm 是一个**无组件**、**无内置规则**的表单状态管理器
- [ ] 支持 `validate`(异步)
- [ ] 💡 更多的点子

**欢迎贡献**
### 欢迎贡献

## 在线尝试

Expand All @@ -63,7 +63,7 @@ SlimeForm 是一个**无组件**、**无内置规则**的表单状态管理器

> ⚗️ **实验性**
```
```shell
npm i slimeform
```

Expand Down Expand Up @@ -305,7 +305,7 @@ SlimeForm 内置了 [Yup](https://github.com/jquense/yup) 同步规则的解析
**首先,你要安装 [Yup](https://github.com/jquense/yup)**

```sh
$ npm install yup
npm install yup
```

然后在代码中导入 `yup``yupFieldRule` 就可以使用了
Expand Down Expand Up @@ -340,6 +340,7 @@ const { form, status } = useForm({
## 建议

一些建议:

1. 使用 `@submit.prevent` 而不是 `@submit` 来屏蔽表单默认提交行为
2. 使用 `isError` 的值来动态地判断是否需要给表单输入框添加红色的描边

Expand Down
9 changes: 0 additions & 9 deletions example/src/components/README.md

This file was deleted.

20 changes: 0 additions & 20 deletions example/src/pages/README.md

This file was deleted.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"lint:example": "eslint ./example",
"lint:format": "eslint .",
"lint:types": "tsc",
"lint:markdown": "markdownlint -c .markdownlint.jsonc **/*.md",
"prepare": "husky install",
"prepublishOnly": "pnpm build",
"clear": "rm -rf dist example/dist",
Expand All @@ -68,6 +69,7 @@
"eslint": "8.14.0",
"husky": "7.0.4",
"jsdom": "^19.0.0",
"markdownlint-cli": "^0.31.1",
"nano-staged": "0.8.0",
"npm-run-all": "4.1.5",
"pnpm": "^7.1.3",
Expand All @@ -91,7 +93,8 @@
},
"sideEffects": false,
"nano-staged": {
"*.{js,ts,md,json,yaml}": "eslint . --fix"
"*.{js,ts,md,json,yaml}": "eslint . --fix",
"*.{md}": "markdownlint -c .markdownlint.jsonc **/*.md"
},
"tsup": {
"entry": {
Expand Down
Loading

0 comments on commit eece5d6

Please sign in to comment.