Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Commit 6971044

Browse files
authored
chore: add textlint (#9)
chore: add textlint
2 parents bca1479 + 801d8df commit 6971044

File tree

6 files changed

+2869
-147
lines changed

6 files changed

+2869
-147
lines changed

.github/workflows/lint.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Lint
2+
on: [pull_request]
3+
jobs:
4+
textlint:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v1
8+
- name: textlint
9+
uses: tsuyoshicho/action-textlint@v1
10+
with:
11+
github_token: ${{ secrets.GITHUB_TOKEN }}
12+
reporter: github-pr-check
13+
textlint_flags: "docs/**/*.md"

.huskyrc.js

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

.textlintrc.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Collection of textlint rule
2+
// https://github.com/textlint/textlint/wiki/Collection-of-textlint-rule
3+
4+
module.exports = {
5+
rules: {
6+
// https://github.com/textlint-ja/textlint-rule-preset-ja-technical-writing
7+
"preset-ja-technical-writing": true,
8+
// https://github.com/textlint-ja/textlint-rule-preset-JTF-style
9+
"preset-jtf-style": {
10+
"1.1.3.箇条書き": false, // 箇条書きの文末に句点(。)以外を許可
11+
"3.1.1.全角文字と半角文字の間": false, // 全角文字と半角文字の間にスペースを入れる
12+
"4.2.7.コロン(:)": false, // 半角コロンを許可
13+
},
14+
// https://github.com/textlint-rule/textlint-rule-prh
15+
prh: { rulePaths: ["./prh.yml"] },
16+
"ja-technical-writing/no-exclamation-question-mark": false, // 文末の感嘆符を許可
17+
"ja-technical-writing/sentence-length": false, // 翻訳完了後に有効化
18+
"ja-technical-writing/max-comma": false, // 翻訳完了後に有効化
19+
"textlint-rule-ja-hiragana-hojodoushi": true,
20+
"textlint-rule-ja-hiragana-fukushi": true,
21+
"textlint-rule-ja-hiragana-keishikimeishi": true,
22+
},
23+
filters: {
24+
// https://github.com/textlint/textlint-filter-rule-comments
25+
comments: true,
26+
// https://github.com/textlint/textlint-filter-rule-whitelist
27+
whitelist: {
28+
allow: ["/^<[\\s\\S]*?/>/m"], // Reactコンポーネントをlintしない
29+
},
30+
},
31+
}

package.json

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,30 @@
11
{
2+
"scripts": {
3+
"lint": "textlint docs/**/*.md -f pretty-error",
4+
"format": "pretty-quick && textlint docs/**/*.md --fix"
5+
},
26
"devDependencies": {
3-
"husky": "^3.0.9",
4-
"prettier": "1.18.2",
5-
"pretty-quick": "^2.0.0"
7+
"husky": "^4.0.7",
8+
"lint-staged": "^9.5.0",
9+
"prettier": "1.19.1",
10+
"pretty-quick": "^2.0.1",
11+
"textlint": "^11.6.1",
12+
"textlint-filter-rule-comments": "^1.2.2",
13+
"textlint-filter-rule-whitelist": "^2.0.0",
14+
"textlint-rule-ja-hiragana-fukushi": "^1.2.0",
15+
"textlint-rule-ja-hiragana-hojodoushi": "^1.0.4",
16+
"textlint-rule-ja-hiragana-keishikimeishi": "^1.0.2",
17+
"textlint-rule-preset-ja-technical-writing": "^4.0.0-beta.0",
18+
"textlint-rule-preset-jtf-style": "^2.3.4"
19+
},
20+
"husky": {
21+
"hooks": {
22+
"pre-commit": "pretty-quick --staged && lint-staged"
23+
}
24+
},
25+
"lint-staged": {
26+
"*.md": [
27+
"textlint"
28+
]
629
}
730
}

prh.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 1
2+
rules:
3+
- expected: エキスパート
4+
pattern: エクスパート
5+
- expected: ユーザー
6+
pattern: /ユーザ(?!ー)/

0 commit comments

Comments
 (0)