Skip to content
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

Setup textlint #869

Closed
wants to merge 14 commits into from
28 changes: 28 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Lint
on:
pull_request:
jobs:
textlint:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: "npm"
cache-dependency-path: package-lock.json
- name: Install
run: |
npm install
- name: Setup reviewdog
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest
- name: Add GitHub review
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
reviewdog -conf=lint/reviewdog.yml -reporter=github-pr-check
9 changes: 9 additions & 0 deletions lint/prh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 1
rules:
- expected: UTokyo
- expected: Wi-Fi
pattern: /[Ww]i.?[Ff]i/
specs:
- from: UTokyo Wi-Fi
to: UTokyo Wi-Fi
- expected: VPN
7 changes: 7 additions & 0 deletions lint/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
runner:
textlint-ja:
cmd: npx textlint -f checkstyle -c lint/textlint-ja.json "src/*/!(en)/**"
format: checkstyle
textlint-en:
cmd: npx textlint -f checkstyle -c lint/textlint-en.json "src/*/en/**"
format: checkstyle
14 changes: 14 additions & 0 deletions lint/textlint-en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"plugins": {},
"filters": {
"comments": true
},
"rules": {
"common-misspellings": true,
"prh": {
"rulePaths": [
"prh.yml"
]
}
}
}
69 changes: 69 additions & 0 deletions lint/textlint-ja.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"plugins": {},
"filters": {
"comments": true,
"allowlist": {
"allow": [
"/「.*?」/",
"/\\d+./"
]
}
},
"rules": {
"common-misspellings": true,
"prh": {
"rulePaths": [
"prh.yml"
]
},
"preset-ja-engineering-paper": {
"ja-hiragana-fukushi": {
"severity": "warning"
},
"ja-hiragana-keishikimeishi": {
"severity": "warning"
},
"ja-hiragana-hojodoushi": {
"severity": "warning"
},
"unify-kuten-and-touten": {
"severity": "error"
},
"no-synonyms": {
"severity": "error"
},
"prh": false,
"use-si-units": false
},
"preset-ja-technical-writing": {
"ja-no-mixed-period": {
"periodMark": "."
},
"ja-no-redundant-expression": {
"severity": "warning"
},
"no-exclamation-question-mark": {
"severity": "error"
},
"max-kanji-continuous-len": {
"max": 8,
"severity": "warning",
"allow": [
"東京大学附属図書館"
]
},
"arabic-kanji-numbers": {
"severity": "warning"
},
"no-doubled-joshi": false,
"sentence-length": false,
"ja-no-weak-phrase": false
},
"preset-jtf-style": {
"1.2.1.句点(。)と読点(、)": false,
"1.2.2.ピリオド(.)とカンマ(,)": false,
"2.2.2.算用数字と漢数字の使い分け": false,
"4.1.3.ピリオド(.)、カンマ(,)": false
}
}
}
Loading