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 all 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"
}
}
147 changes: 147 additions & 0 deletions textlint/prh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# prh version
version: 1
rules:

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

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

- expected: $1き$2
pattern: /(て|[いん]で)来(て|た|なさ|なよ|つつ|ながら|ま)/
prh: 補助動詞はかな書きにします
specs:
- from: やって来ました
to: やってきました
- from: チャリで来た
to: チャリで来た
- expected: $1こ$2
pattern: /(て|[いん]で)来(い|な|よ)/
prh: 補助動詞はかな書きにします
specs:
- from: メッセージが出て来ない場合
to: メッセージが出てこない場合
- 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とき$2
pattern: /([うくぐすつぬぶむる]|[なの]|[いん]だ|た)時(は|が|で|を|すら|な|の|に|も|から|まで|、|。|$)/
prh: 形式名詞としての「とき」はかな書きにします
specs:
- 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: 純粋関数

- expected: プレフィックス
pattern: プレフィクス

- expected: サフィックス
pattern: サフィクス

- expected: プレーヤ
patterns:
- プレーヤー
- プレイヤー
- プレイヤ
Loading