Skip to content

Restore textlint, as a subpackage #580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
"tsc": "tsc --noEmit",
"start": "next start",
"postinstall": "patch-package && (is-ci || husky install .husky)",
"check-all": "npm-run-all prettier lint:fix tsc"
"check-all": "npm-run-all prettier lint:fix tsc",
"textlint": "cd textlint && yarn --frozen-lockfile && yarn textlint",
"textlint-staged": "cd textlint && yarn --frozen-lockfile && yarn textlint-staged --"
},
"dependencies": {
"@codesandbox/sandpack-react": "1.15.5",
Expand Down Expand Up @@ -107,6 +109,6 @@
},
"lint-staged": {
"*.{js,ts,jsx,tsx,css}": "yarn prettier",
"src/**/*.md": "yarn fix-headings"
"src/**/*.md": ["yarn fix-headings", "yarn textlint-staged --"]
}
}
76 changes: 0 additions & 76 deletions prh.yml
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

リポジトリルートにあった旧サイト用設定ファイルなので削除

This file was deleted.

1 change: 1 addition & 0 deletions textlint/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
13 changes: 7 additions & 6 deletions .textlintrc → textlint/.textlintrc.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
{
"plugins": {},
"filters": {},
"rules": {
"preset-jtf-style": {
"1.1.3.箇条書き": false,
"1.2.1.句点(。)と読点(、)": false,
"1.2.2.ピリオド(.)とカンマ(,)": false,
"3.1.1.全角文字と半角文字の間": false,
"4.1.1.句点(。)": false,
"4.2.1.感嘆符(!)": false,
"4.2.2.疑問符(?)": false
},
"@textlint-rule/no-invalid-control-character": {
"checkCode": true
"4.2.2.疑問符(?)": false,
"4.3.7.山かっこ<>": false
},
"prh": {
"severity" : "warning",
"rulePaths" :["./prh.yml"]
"rulePaths": ["./prh.yml"],
"checkBlockQuote": true
}
}
}
18 changes: 18 additions & 0 deletions textlint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "ja-react-dev-textlint",
"version": "0.1.0",
"description": "Checks Markdown on ja.react.dev",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"textlint": "textlint --rulesdir=. ../src/content",
"textlint-staged": "textlint --rulesdir=. --"
},
"author": "Soichiro Miki",
"license": "MIT",
"dependencies": {
"textlint": "^13.3.2",
"textlint-rule-preset-jtf-style": "^2.3.13",
"textlint-rule-prh": "^5.3.0"
}
}
139 changes: 139 additions & 0 deletions textlint/prh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# prh version
version: 1
rules:

- expected: $1くださ
pattern: /(て|[いん]で)下さ/
prh: 補助動詞はかな書きにします

- expected: $1み$3
pattern: /((つい)?て|[いん]で)見(て|た|よ|る|ま|な|れ|ろ|ず|つつ|ながら)/
regexpMustEmpty: $2
prh: 補助動詞はかな書きにします
specs:
- from: やって見てください
to: やってみてください
- from: 見て見ませんか
to: 見てみませんか
- from: 本件について見ていると
to: 本件について見ていると
- from: テレビで見た
to: テレビで見た

- expected: $1き$2
pattern: /(て|[いん]で)来(て|た|なさ|なよ|つつ|ながら|ま)/
prh: 補助動詞はかな書きにします
specs:
- from: やって来ました
to: やってきました
- expected: $1こ$2
pattern: /(て|[いん]で)来(い|な|よ)/
prh: 補助動詞はかな書きにします
- expected: $1く$2
pattern: /(て|[いん]で)来(る|れ)/
prh: 補助動詞はかな書きにします
specs:
- from: 見て来る
to: 見てくる
- from: 飛んで来れば
to: 飛んでくれば

- expected: $1しま$2
pattern: /(て|[いん]で)仕舞(わ|い|う|え|お|っ)/
prh: 補助動詞はかな書きにします

- expected: $1い$3
# 「行っ(て)」は「おこなっ」とも読めるため除外
pattern: /((つい)?て|[いん]で)行(か|き|く|け|こ)/
regexpMustEmpty: $2
prh: 補助動詞はかな書きにします
specs:
- from: 泳いで行こう
to: 泳いでいこう
- from: 本件について行くべき場所
to: 本件について行くべき場所
- from: 最優先で行った
to: 最優先で行った

- expected: $1お$2
pattern: /(て|[いん]で)置(か|き|く|け|こ|い)/
prh: 補助動詞はかな書きにします

- expected: ついに
pattern: /遂に/
prh: 語彙化した副詞はなるべくかな書きにします

- expected: まれに
pattern: /(希|稀)に/
prh: 語彙化した副詞はなるべくかな書きにします

- expected: ようやく
pattern: /漸く/
prh: 語彙化した副詞はかな書きにします

- expected: しばらく
pattern: /暫く/
prh: 語彙化した副詞はかな書きにします

- expected: おそらく
pattern: 恐らく
prh: 語彙化した副詞はかな書きにします

- expected: $1とき
pattern: /(な|の|た|[いん]だ)時(?!点|代|々|間|刻|計)/
prh: 形式名詞としての「とき」はかな書きにします
specs:
- from: その時
to: そのとき
- from: その時点
to: その時点
- from: その時代
to: その時代
- from: それまでの時間
to: それまでの時間
- from: 同時
to: 同時
- from: 実行時
to: 実行時
- from: 利用時
to: 利用時
- from: 開発時
to: 開発時
- from: 時点
to: 時点
- from: 時代
to: 時代
- from: 時間
to: 時間
- from: 時計
to: 時計

- expected: $1
pattern: /(ユーザ|リスナ|エディタ|ハンドラ|トリガ|バンドラ|テスタ|リンタ|フォーマッタ|レンダラ)ー/
prh: 3音以上の技術用語の最後の長音府は原則として省略します

- expected: $1レンダー
pattern: /(初回|再|条件付き)レンダリング/
prh: レンダリングではなくレンダーとします
specs:
- from: 初回レンダリング
to: 初回レンダー
- from: 再レンダリング
to: 再レンダー

- expected: レンダー$1
pattern: /レンダリング(する|し|時|後|前)/
prh: レンダリングではなくレンダーとします

- expected: コンテクスト
pattern: コンテキスト

- expected: エクスポート
pattern: エキスポート

- expected: 伝播
pattern: 伝搬
prh: イベントの propagation は伝搬ではなく伝播とします

- expected: 純関数
pattern: 純粋関数
Loading