├── .github ├── dependabot.yml └── workflows │ ├── release.yml │ └── test.yml ├── .gitignore ├── .husky └── commit-msg ├── .npmignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── dict ├── prh_bengo4.yml ├── prh_mistakes.yml ├── prh_redundancy.yml └── prh_writing.yml ├── example ├── .textlintrc.json ├── package.json └── sample.md ├── package-lock.json ├── package.json ├── src ├── @types │ └── @textlint │ │ └── @module-interop.d.ts ├── index.ts └── prh-rules.ts ├── test └── index-test.js └── tsconfig.json /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "npm" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | timezone: "Asia/Tokyo" 13 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | on: 3 | workflow_run: 4 | workflows: 5 | - Test 6 | branches: 7 | - main 8 | types: 9 | - completed 10 | 11 | jobs: 12 | release: 13 | name: Release 14 | runs-on: ubuntu-latest 15 | if: ${{ github.event.workflow_run.conclusion == 'success' }} 16 | 17 | steps: 18 | - name: Checkout 19 | uses: actions/checkout@v2 20 | with: 21 | fetch-depth: 0 22 | 23 | - name: Setup NodeJS 16 24 | uses: actions/setup-node@v2 25 | with: 26 | node-version: 16 27 | 28 | - name: Install dependencies 29 | run: npm ci 30 | 31 | - name: Release 32 | env: 33 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 34 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 35 | run: npx semantic-release 36 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | test: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - name: Checkout 11 | uses: actions/checkout@v2 12 | with: 13 | fetch-depth: 0 14 | 15 | - name: Setup NodeJS 16 16 | uses: actions/setup-node@v2 17 | with: 18 | node-version: 16 19 | 20 | - name: Install dependencies 21 | run: npm ci 22 | 23 | - name: Run Test 24 | run: npm test 25 | 26 | - name: Run Example 27 | run: | 28 | npm run example 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | 3 | lib/ 4 | 5 | example/package-lock.json 6 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx --no-install commitlint --edit "$1" 5 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .github 2 | .husky 3 | 4 | /example 5 | /src 6 | /test 7 | 8 | tsconfig.json 9 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [2.2.2](https://github.com/bengo4/textlint-rule-preset-bengo4/compare/v2.2.1...v2.2.2) (2023-04-17) 2 | 3 | 4 | ### Bug Fixes 5 | 6 | * CloudSignのpatternsを追加 ([9d0fcff](https://github.com/bengo4/textlint-rule-preset-bengo4/commit/9d0fcff3eb3a8db4667064048058cd1cb47d3027)) 7 | 8 | ## [2.2.1](https://github.com/bengo4/textlint-rule-preset-bengo4/compare/v2.2.0...v2.2.1) (2022-07-27) 9 | 10 | 11 | ### Bug Fixes 12 | 13 | * **deps:** bump textlint-rule-preset-jtf-style from 2.3.12 to 2.3.13 ([#61](https://github.com/bengo4/textlint-rule-preset-bengo4/issues/61)) ([09f6f80](https://github.com/bengo4/textlint-rule-preset-bengo4/commit/09f6f80c591861f5a6f13f3a3595f171f361abcf)) 14 | 15 | # [2.2.0](https://github.com/bengo4/textlint-rule-preset-bengo4/compare/v2.1.1...v2.2.0) (2022-05-26) 16 | 17 | 18 | ### Features 19 | 20 | * 業務支援事業のワードを追加、修正 ([#34](https://github.com/bengo4/textlint-rule-preset-bengo4/issues/34)) ([1871297](https://github.com/bengo4/textlint-rule-preset-bengo4/commit/18712976ad698218abd546ac724026643bf2d099)) 21 | 22 | ## [2.1.1](https://github.com/bengo4/textlint-rule-preset-bengo4/compare/v2.1.0...v2.1.1) (2022-05-11) 23 | 24 | 25 | ### Bug Fixes 26 | 27 | * **deps:** bump textlint-rule-ja-no-redundant-expression ([#18](https://github.com/bengo4/textlint-rule-preset-bengo4/issues/18)) ([b3623ee](https://github.com/bengo4/textlint-rule-preset-bengo4/commit/b3623ee882aa7205d08675cd8fca9069865bac61)) 28 | 29 | # [2.1.0](https://github.com/bengo4/textlint-rule-preset-bengo4/compare/v2.0.1...v2.1.0) (2022-05-08) 30 | 31 | 32 | ### Features 33 | 34 | * **deps:** bump textlint-rule-preset-japanese from 6.0.1 to 7.0.0 ([#17](https://github.com/bengo4/textlint-rule-preset-bengo4/issues/17)) ([ccb47bc](https://github.com/bengo4/textlint-rule-preset-bengo4/commit/ccb47bc58dcf185ad711812e7af3fa39343badd3)) 35 | 36 | ## [2.0.1](https://github.com/bengo4/textlint-rule-preset-bengo4/compare/v2.0.0...v2.0.1) (2022-03-11) 37 | 38 | 39 | ### Bug Fixes 40 | 41 | * SMBCクラウドサインのルールを追加 ([#12](https://github.com/bengo4/textlint-rule-preset-bengo4/issues/12)) ([121d94e](https://github.com/bengo4/textlint-rule-preset-bengo4/commit/121d94e523e74f793ef8cf4d638fc3afc40e602e)) 42 | 43 | ## [2.0.0](https://github.com/bengo4/textlint-rule-preset-bengo4/compare/v1.0.4...v2.0.0) (2021-12-02) 44 | 45 | 46 | ### BREAKING CHANGE 47 | 48 | * 全角文字と半角文字の間にスペースを入れないルールを無効化 ([#10](https://github.com/bengo4/textlint-rule-preset-bengo4/issues/10)) ([aa7d926](https://github.com/bengo4/textlint-rule-preset-bengo4/commit/aa7d926d5574d3f47c6f4989a56ee28c8c062cf5)) 49 | 50 | ## [1.0.4](https://github.com/bengo4/textlint-rule-preset-bengo4/compare/v1.0.3...v1.0.4) (2021-11-30) 51 | 52 | 53 | ### Bug Fixes 54 | 55 | * 用語を追加(クラウドサインのサービス名、プラン名ほか) ([#9](https://github.com/bengo4/textlint-rule-preset-bengo4/issues/9)) ([a816291](https://github.com/bengo4/textlint-rule-preset-bengo4/commit/a816291a6358d9c62d368f8020b02afafe05b031)) 56 | 57 | ## [1.0.3](https://github.com/bengo4/textlint-rule-preset-bengo4/compare/v1.0.2...v1.0.3) (2021-08-20) 58 | 59 | 60 | ### Bug Fixes 61 | 62 | * 正規表現の誤りを修正、specsプロパティを追加 ([#7](https://github.com/bengo4/textlint-rule-preset-bengo4/issues/7)) ([833ad29](https://github.com/bengo4/textlint-rule-preset-bengo4/commit/833ad2930ccbf6797312eef7d06ed2b9b779c344)) 63 | 64 | ## [1.0.2](https://github.com/bengo4/textlint-rule-preset-bengo4/compare/v1.0.1...v1.0.2) (2021-08-20) 65 | 66 | 67 | ### Bug Fixes 68 | 69 | * 用語を追加(よく使われるサービス名、句読点のルール) ([#6](https://github.com/bengo4/textlint-rule-preset-bengo4/issues/6)) ([23788b0](https://github.com/bengo4/textlint-rule-preset-bengo4/commit/23788b07a7347f5c2b4a8ccf6237ff19697d9d80)) 70 | 71 | ## [1.0.1](https://github.com/bengo4/textlint-rule-preset-bengo4/compare/v1.0.0...v1.0.1) (2021-07-19) 72 | 73 | 74 | ### Bug Fixes 75 | 76 | * ルール追加、動作していなかったルールの修正 ([c8f0f0a](https://github.com/bengo4/textlint-rule-preset-bengo4/commit/c8f0f0aa5e52f326c68591649586857b7a8a9c67)) 77 | 78 | # 1.0.0 (2021-07-09) 79 | 80 | 81 | ### Features 82 | 83 | * add initial textlint-prh rules ([eb58105](https://github.com/bengo4/textlint-rule-preset-bengo4/commit/eb5810525ab002bead9c133567868d097c110830)) 84 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Bengo4.com, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # textlint-rule-preset-bengo4 2 | 3 | [![Test](https://github.com/bengo4/textlint-rule-preset-bengo4/actions/workflows/test.yml/badge.svg)](https://github.com/bengo4/textlint-rule-preset-bengo4/actions/workflows/test.yml) 4 | 5 | 弁護士ドットコムで使われているtextlintプリセット 6 | 7 | ## Installation 8 | 9 | Install with [npm](https://www.npmjs.com/): 10 | 11 | ```sh 12 | npm install textlint-rule-preset-bengo4 13 | ``` 14 | ## Usage 15 | 16 | すべてのルールを有効化して使う場合は、次のように設定してください。 17 | 18 | ```json 19 | { 20 | "rules": { 21 | "preset-bengo4": true 22 | } 23 | } 24 | ``` 25 | 26 | ### Settings 27 | 28 | 表記ゆれ修正用の辞書の設定には`textlint-rule-prh`を使っています。 29 | 対応用語は`dict/`フォルダに入っている`.yml`を確認してください。 30 | 31 | ## Default Rule list 32 | 33 | - 一般的な文書で利用するためのルール(二重否定、ら抜き表現、一文の文字数ほか) 34 | - https://github.com/textlint-ja/textlint-rule-preset-japanese 35 | - 一文で使える"、"の数 36 | - https://github.com/textlint-ja/textlint-rule-max-ten 37 | - 逆接の接続助詞「が」が、同一文中に複数回出現していないかどうか 38 | - https://github.com/takahashim/textlint-rule-no-doubled-conjunctive-particle-ga 39 | - 同じ接続詞で開始されていることを検出 40 | - https://github.com/takahashim/textlint-rule-no-doubled-conjunction 41 | - 二重否定の検出 42 | - https://github.com/textlint-ja/textlint-rule-no-double-negative-ja 43 | - 二重助詞の検出 44 | - https://github.com/textlint-ja/textlint-rule-no-doubled-joshi 45 | - 一文の最大の長さ 46 | - https://github.com/azu/textlint-rule-sentence-length 47 | - ら抜き言葉を使用しない 48 | - https://github.com/azu/textlint-rule-no-dropping-the-ra 49 | - 文の敬体(ですます調)、常体(である調)の混合をチェック 50 | - https://github.com/textlint-ja/textlint-rule-no-mix-dearu-desumasu 51 | - ホ゜ケット エンシ゛ン のような、Mac OS XでPDFやFinderからのコピペで発生する濁点のチェック 52 | - https://github.com/azu/textlint-rule-no-nfd 53 | - 制御文字の検出 54 | - https://github.com/textlint-rule/textlint-rule-no-invalid-control-character 55 | - ゼロ幅スペースの検出 56 | - https://github.com/textlint-rule/textlint-rule-no-zero-width-spaces 57 | - 康煕部首の検出 58 | - https://github.com/xl1/textlint-rule-no-kangxi-radicals 59 | - JTF日本語標準スタイルガイドのルール 60 | - https://github.com/textlint-ja/textlint-rule-preset-JTF-style 61 | - 表記ルール(ひらく漢字) 62 | - https://github.com/lostandfound/textlint-rule-ja-hiragana-keishikimeishi 63 | - https://github.com/lostandfound/textlint-rule-ja-hiragana-fukushi 64 | - https://github.com/lostandfound/textlint-rule-ja-hiragana-hojodoushi 65 | - 冗長な表現 66 | - https://github.com/textlint-ja/textlint-rule-ja-no-redundant-expression 67 | - 敬体(ですます調)と常体(である調)の混在をチェック 68 | - https://github.com/textlint-ja/textlint-rule-no-mix-dearu-desumasu 69 | - 対のカッコがあることをチェック 70 | - https://github.com/textlint-rule/textlint-rule-no-unmatched-pair 71 | 72 | ## Development 73 | 74 | ```sh 75 | npm ci 76 | npx husky install 77 | ``` 78 | 79 | ### Commit message 80 | 81 | コミットメッセージは[Angularのコミットメッセージフォーマット](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format)に従ってください。 82 | 83 | それによりリリースを自動化しています。詳しくは[リリース](#リリース)参照 84 | 85 | よく使うものを掲載します。scopeは不要です。 86 | 87 | ``` 88 | <種別>: <具体的な変更内容> 89 | 90 | 例 91 | fix: 日本語の副詞「と」のルールを修正 92 | ``` 93 | 94 | | 種別 | 内容 | マージリリース| バージョン | 95 | | -- | -- | -- | -- | 96 | | feat | 新しい機能 | 〇 | Miner Release | 97 | | fix | バグ修正&軽微な修正 | 〇 | Patch Release | 98 | | perf | コードのパフォーマンス修正 | 〇 | Major Release | 99 | | BREAKING CHANGE | 互換性のない破壊的変更 | 〇 | Major Release | 100 | | refactor| バグ修正や機能追加のないリファクタリング | | | 101 | | test | テストパターンの追加や既存テストの修正 | | | 102 | | docs | ドキュメントの変更 | | | 103 | | chore | ビルドプロセスの改善など、上記に該当しないもの | | | 104 | 105 | ### Example execute 106 | 107 | `example`フォルダ内のテストコードを実行します。 108 | 109 | ```sh 110 | npm run example 111 | ``` 112 | 113 | ### Tests 114 | 115 | `test`フォルダ内のテストコードを実行します。 116 | 117 | testの詳細は[textlint-tester](https://github.com/textlint/textlint-tester)を参照してください。 118 | 119 | ```sh 120 | npm test 121 | ``` 122 | 123 | ### Release 124 | 125 | [semantic-release](https://semantic-release.gitbook.io/semantic-release/)で、GitHub Actionでmainブランチにマージするとリリースされます。 126 | 127 | 大まかな処理のステップは4段階です。 128 | 129 | 1. 既存のGitタグと、コミットの解析で自動バージョン決め 130 | 1. Gitのタグうち 131 | 1. CHANGELOG.md自動作成&コミット 132 | 1. npmへのパッケージ公開 133 | -------------------------------------------------------------------------------- /dict/prh_bengo4.yml: -------------------------------------------------------------------------------- 1 | meta: 2 | - title: 弁護士ドットコム固有の名称・表記ルール 3 | - memo: 汎用的ではない、弁護士ドットコム固有のルールを追加する 4 | rules: 5 | # サービス名 6 | - expected: 弁護士ドットコム 7 | patterns: 弁コム 8 | prh: サービス名の場合は略さず表記します 9 | - expected: 弁護士ドットコムLIBRARY 10 | patterns: /弁護士ドットコム\s?(Library|library|LIBRARY)/ 11 | prh: サービス名(英語表記) 12 | specs: 13 | - from: 弁護士ドットコムLibrary 14 | to: 弁護士ドットコムLIBRARY 15 | - from: 弁護士ドットコム library 16 | to: 弁護士ドットコムLIBRARY 17 | - expected: 弁護士ドットコムライブラリー 18 | patterns: /弁護士ドットコムライブラリ([^ー])/ 19 | prh: カタカナ表記時は長音(ー)あり 20 | - expected: 弁護士ドットコムライブラリー 21 | patterns: /弁護士ドットコム\s?(ライブラリー|ライブラリ)/ 22 | prh: サービス名の場合はスペースを空けずに表記します 23 | specs: 24 | - from: 弁護士ドットコム ライブラリー 25 | to: 弁護士ドットコムライブラリー 26 | - expected: GYOSYS 27 | patterns: gyosys 28 | prh: サービス名(英語表記) 29 | - expected: 弁護士ドットコム案件管理システム 30 | patterns: /弁護士ドットコム\s?案件管理システム/ 31 | prh: サービス名の場合はスペースを空けずに表記します 32 | specs: 33 | - from: 弁護士ドットコム 案件管理システム 34 | to: 弁護士ドットコム案件管理システム 35 | - expected: 弁護士ドットコムオンラインセミナー 36 | patterns: /弁護士ドットコム\s?オンラインセミナー/ 37 | prh: サービス名の場合はスペースを空けずに表記します 38 | specs: 39 | - from: 弁護士ドットコム オンラインセミナー 40 | to: 弁護士ドットコムオンラインセミナー 41 | - expected: 弁護士向け電話代行サービス 42 | patterns: /弁護士向け\s?電話代行サービス/ 43 | prh: サービス名の場合はスペースを空けずに表記します 44 | specs: 45 | - from: 弁護士向け 電話代行サービス 46 | to: 弁護士向け電話代行サービス 47 | - expected: 税理士ドットコム 48 | patterns: 税コム 49 | prh: サービス名の場合は略さず表記します 50 | - expected: BUSINESS LAWYERS 51 | patterns: /(Business Lawyers|Business lawyers|business lawyers)/ 52 | prh: サービス名(英語表記) 53 | - expected: BUSINESS LAWYERS$1 54 | patterns: /BL(で|に|を|は|が|の|と|も)/ 55 | prh: サービス名の場合は略さず表記します 56 | - expected: CloudSign 57 | patterns: /(CLOUDSIGN|cloudsign|Cloudsign)/ 58 | prh: サービス名(英語表記) 59 | - expected: クラウドサイン AI 60 | patterns: /クラウドサイン ?ai/i 61 | specs: 62 | - from: クラウドサインAI 63 | to: クラウドサイン AI 64 | - from: クラウドサインai 65 | to: クラウドサイン AI 66 | - expected: クラウドサイン NOW 67 | patterns: /クラウドサイン ?now/i 68 | specs: 69 | - from: クラウドサインNOW 70 | to: クラウドサイン NOW 71 | - from: クラウドサインnow 72 | to: クラウドサイン NOW 73 | - expected: クラウドサイン SCAN 74 | patterns: /クラウドサイン ?scan/i 75 | specs: 76 | - from: クラウドサインSCAN 77 | to: クラウドサイン SCAN 78 | - from: クラウドサインscan 79 | to: クラウドサイン SCAN 80 | - expected: クラウドサイン Sales Automation 81 | patterns: /クラウドサイン ?sales ?automation/i 82 | specs: 83 | - from: クラウドサインSales Automation 84 | to: クラウドサイン Sales Automation 85 | - from: クラウドサイン SalesAutomation 86 | to: クラウドサイン Sales Automation 87 | - from: クラウドサインSalesAutomation 88 | to: クラウドサイン Sales Automation 89 | - from: クラウドサイン SALES AUTOMATION 90 | to: クラウドサイン Sales Automation 91 | - from: クラウドサインSALES AUTOMATION 92 | to: クラウドサイン Sales Automation 93 | - expected: クラウドサイン ペイメント 94 | patterns: /クラウドサイン ?(ペイメント|PAYMENT|Payment|payment)/i 95 | specs: 96 | - from: クラウドサインペイメント 97 | to: クラウドサイン ペイメント 98 | - from: クラウドサインPAYMENT 99 | to: クラウドサイン ペイメント 100 | - from: クラウドサイン PAYMENT 101 | to: クラウドサイン ペイメント 102 | - expected: クラウドサイン MAKE 103 | patterns: /クラウドサイン ?(MAKE|Make|make)/i 104 | specs: 105 | - from: クラウドサインMAKE 106 | to: クラウドサイン MAKE 107 | - expected: クラウドサイン FILING 108 | patterns: /クラウドサイン ?(FILING|Filing|filing)/i 109 | specs: 110 | - from: クラウドサインFILING 111 | to: クラウドサイン FILING 112 | - expected: クラウドサイン for Box 113 | patterns: /クラウドサイン ?for ?box/i 114 | specs: 115 | - from: クラウドサインforBox 116 | to: クラウドサイン for Box 117 | - from: クラウドサインforBox 118 | to: クラウドサイン for Box 119 | - from: クラウドサイン forBox 120 | to: クラウドサイン for Box 121 | - from: クラウドサインfor Box 122 | to: クラウドサイン for Box 123 | - from: クラウドサイン for box 124 | to: クラウドサイン for Box 125 | - expected: クラウドサイン Salesforce版 126 | patterns: /クラウドサイン ?Salesforce版/i 127 | specs: 128 | - from: クラウドサインSalesforce版 129 | to: クラウドサイン Salesforce版 130 | - from: クラウドサインsalesforce版 131 | to: クラウドサイン Salesforce版 132 | - from: クラウドサイン salesforce版 133 | to: クラウドサイン Salesforce版 134 | - expected: クラウドサイン CONNECT 135 | patterns: /クラウドサイン ?(CONNECT|コネクト)/i 136 | specs: 137 | - from: クラウドサインCONNECT 138 | to: クラウドサイン CONNECT 139 | - from: クラウドサインコネクト 140 | to: クラウドサイン CONNECT 141 | - from: クラウドサイン コネクト 142 | to: クラウドサイン CONNECT 143 | - expected: SMBCクラウドサイン 144 | patterns: 145 | - /SMBC\s*(クラウドサイン|CloudSign)/i 146 | specs: 147 | - from: SMBCCloudSign 148 | to: SMBCクラウドサイン 149 | - from: SMBC クラウドサイン 150 | to: SMBCクラウドサイン 151 | - from: smbcクラウドサイン 152 | to: SMBCクラウドサイン 153 | - from: SMBC CloudSign 154 | to: SMBCクラウドサイン 155 | - expected: サインのリ・デザイン 156 | patterns: サインのリデザイン 157 | # 機能 158 | - expected: 一括見積り 159 | patterns: 一括見積もり 160 | prh: 機能名 161 | - expected: 感謝の声をおくる 162 | patterns: /感謝の声を(送る|寄せる|投稿する)/ 163 | prh: 機能名 164 | - expected: みんなの法律相談 165 | patterns: 166 | - みん法 167 | - 皆の法律相談 168 | prh: 機能名 169 | # プラン 170 | - expected: $1ライトプラン 171 | patterns: /(クラウドサイン.*)(Lightプラン)/ 172 | specs: 173 | - from: クラウドサインの契約画面で、Lightプランをお選びください 174 | to: クラウドサインの契約画面で、ライトプランをお選びください 175 | prh: 末に「プラン」をつける場合はカタカナ表記にします(「プラン」をつけない場合は英語表記でも可) 176 | - expected: ライトプラン$2 177 | patterns: /(Lightプラン)(.*クラウドサイン)/ 178 | specs: 179 | - from: まずはLightプランでクラウドサインをお試しください 180 | to: まずはライトプランでクラウドサインをお試しください 181 | prh: 末に「プラン」をつける場合はカタカナ表記にします(「プラン」をつけない場合は英語表記でも可) 182 | - expected: $1コーポレートプラン 183 | patterns: /(クラウドサイン.*)(Corporateプラン)/ 184 | specs: 185 | - from: クラウドサインの契約画面で、Corporateプランをお選びください 186 | to: クラウドサインの契約画面で、コーポレートプランをお選びください 187 | prh: 末に「プラン」をつける場合はカタカナ表記にします(「プラン」をつけない場合は英語表記でも可) 188 | - expected: コーポレートプラン$2 189 | patterns: /(Corporateプラン)(.*クラウドサイン)/ 190 | specs: 191 | - from: まずはCorporateプランでクラウドサインをお試しください 192 | to: まずはコーポレートプランでクラウドサインをお試しください 193 | prh: 末に「プラン」をつける場合はカタカナ表記にします(「プラン」をつけない場合は英語表記でも可) 194 | - expected: $1エンタープライズプラン 195 | patterns: /(クラウドサイン.*)(Enterpriseプラン)/ 196 | specs: 197 | - from: クラウドサインの契約画面で、Enterpriseプランをお選びください 198 | to: クラウドサインの契約画面で、エンタープライズプランをお選びください 199 | prh: 末に「プラン」をつける場合はカタカナ表記にします(「プラン」をつけない場合は英語表記でも可) 200 | - expected: エンタープライズプラン$2 201 | patterns: /(Enterpriseプラン)(.*クラウドサイン)/ 202 | specs: 203 | - from: まずはEnterpriseプランでクラウドサインをお試しください 204 | to: まずはエンタープライズプランでクラウドサインをお試しください 205 | prh: 末に「プラン」をつける場合はカタカナ表記にします(「プラン」をつけない場合は英語表記でも可) 206 | # 用語 207 | - expected: スマートフォン 208 | patterns: 209 | - スマートホン 210 | - スマホ 211 | - スマフォ 212 | - expected: ユーザー 213 | pattern: /ユーザ(?!ー|ビリティ|セグメント)/ 214 | specs: 215 | - from: ユーザ 216 | to: ユーザー 217 | - expected: サーバー 218 | pattern: /サーバ(?!ー)/ 219 | specs: 220 | - from: サーバ 221 | to: サーバー 222 | - expected: ブラウザ 223 | pattern: ブラウザー 224 | - expected: セキュリティ 225 | pattern: セキュリティー 226 | - expected: ウェブサイト 227 | pattern: /(web|Web|WEB)サイト/ 228 | specs: 229 | - from: webサイト 230 | to: ウェブサイト 231 | - expected: カテゴリ 232 | patterns: カテゴリー 233 | - expected: 二割司法 234 | patterns: 2割司法 235 | - expected: コミュニティ 236 | patterns: コミュニティー 237 | - expected: Google 238 | patterns: /(GOOGLE|google)/ 239 | specs: 240 | - from: GOOGLE 241 | to: Google 242 | - expected: Amazon 243 | patterns: /(AMAZON|amazon)/ 244 | specs: 245 | - from: AMAZON 246 | to: Amazon 247 | - expected: Facebook 248 | patterns: /(FACEBOOK|facebook)/ 249 | specs: 250 | - from: FACEBOOK 251 | to: Facebook 252 | - expected: Apple 253 | patterns: /(APPLE|apple)/ 254 | specs: 255 | - from: APPLE 256 | to: Apple 257 | - expected: Yahoo 258 | patterns: /(YAHOO|yahoo)/ 259 | specs: 260 | - from: YAHOO 261 | to: Yahoo 262 | -------------------------------------------------------------------------------- /dict/prh_mistakes.yml: -------------------------------------------------------------------------------- 1 | meta: 2 | - title: 誤字・誤用 3 | - memo: よくある誤字・誤用を追記する 4 | rules: 5 | - expected: コミュニケーション 6 | patterns: コミニュケーション 7 | - expected: シミュレーション 8 | patterns: シュミレーション 9 | - expected: ご使用 10 | patterns: ご仕様 11 | - expected: うろ覚え 12 | patterns: うる覚え 13 | - expected: そういう 14 | patterns: そうゆう 15 | - expected: どういう 16 | patterns: どうゆう 17 | - expected: しづらい 18 | patterns: しずらい 19 | - expected: いずれ 20 | patterns: いづれ 21 | - expected: 少しずつ 22 | patterns: 少しづつ 23 | - expected: 後を立たない 24 | patterns: 後を絶たない 25 | - expected: 念頭に置く 26 | patterns: 念頭に入れる 27 | - expected: 似て非なる 28 | patterns: 似て異なる 29 | - expected: $1に応える 30 | patterns: /(ニーズ|需要)に答える/ 31 | specs: 32 | - from: ニーズに答える 33 | to: ニーズに応える 34 | - expected: $1を傾ける 35 | patterns: /(うんちく|薀蓄)を垂れる/ 36 | specs: 37 | - from: うんちくを垂れる 38 | to: うんちくを傾ける 39 | - expected: 並べ替え 40 | patterns: 並び替え 41 | - expected: ありがとう 42 | patterns: 有難う 43 | - expected: ございま$1 44 | patterns: /御座いま(す|した|せん)/ 45 | specs: 46 | - from: 御座います 47 | to: ございます 48 | -------------------------------------------------------------------------------- /dict/prh_redundancy.yml: -------------------------------------------------------------------------------- 1 | meta: 2 | - title: 冗長な表現 3 | - memo: 二重敬語ほか、冗長になりがちな表現を追加する 4 | rules: 5 | - expected: いたします 6 | patterns: させていただきます 7 | prh: 簡潔な表現にすると、文章がより明瞭になります 8 | - expected: お送りします 9 | patterns: お送りさせていただきます 10 | prh: 簡潔な表現にすると、文章がより明瞭になります 11 | - expected: お読みになりましたか 12 | patterns: お読みになられましたか 13 | prh: 簡潔な表現にすると、文章がより明瞭になります 14 | - expected: ください。 15 | patterns: 16 | - くださいませ。 17 | - くださいませんでしょうか。 18 | prh: 簡潔な表現にすると、文章がより明瞭になります 19 | - expected: した 20 | patterns: させていただいた 21 | prh: 簡潔な表現にすると、文章がより明瞭になります 22 | - expected: 送信してください 23 | patterns: ご送信ください 24 | prh: 簡潔な表現にすると、文章がより明瞭になります 25 | - expected: 拝見しました 26 | pattern: 拝見させていただきました 27 | - expected: します 28 | patterns: していきます 29 | prh: 簡潔な表現にすると、文章がより明瞭になります 30 | - expected: ございますか 31 | patterns: ございますでしょうか 32 | prh: 簡潔な表現にすると、文章がより明瞭になります 33 | - expected: お願いできますか 34 | patterns: お願いできますでしょうか 35 | prh: 簡潔な表現にすると、文章がより明瞭になります 36 | - expected: いただけますか 37 | patterns: 38 | - いただけますでしょうか 39 | - いただいてもよろしいでしょうか 40 | prh: 簡潔な表現にすると、文章がより明瞭になります 41 | -------------------------------------------------------------------------------- /dict/prh_writing.yml: -------------------------------------------------------------------------------- 1 | meta: 2 | - title: 表記のルール 3 | - memo: 汎用的な表記のルールを追加する 4 | rules: 5 | # あ行 6 | - expected: あえて 7 | patterns: 敢えて 8 | - expected: あらかじめ 9 | patterns: 予め 10 | - expected: あるいは 11 | patterns: 或いは 12 | - expected: あわせて 13 | patterns: 併せて 14 | - expected: いか 15 | patterns: 如何 16 | - expected: いずれ 17 | patterns: 何れ 18 | - expected: いたします 19 | patterns: 致します 20 | - expected: いただく 21 | patterns: 頂く 22 | - expected: 今さら 23 | patterns: 今更 24 | - expected: いろいろ 25 | patterns: 色々 26 | - expected: いわゆる 27 | patterns: 所謂 28 | - expected: 受付開始 29 | patterns: /(受付け|受け付け)開始/ 30 | specs: 31 | - from: 受付け開始 32 | to: 受付開始 33 | - expected: 受付時間 34 | patterns: /(受付け|受け付け)時間/ 35 | specs: 36 | - from: 受付け時間 37 | to: 受付時間 38 | - expected: 受付設定 39 | patterns: /(受付け|受け付け)設定/ 40 | specs: 41 | - from: 受付け設定 42 | to: 受付設定 43 | - expected: 受け付け$1 44 | patterns: /受付け(る|ない|ず|て|ます|ません)/ 45 | specs: 46 | - from: 受付ける 47 | to: 受け付ける 48 | - expected: 受け取$1 49 | patterns: /受取(る|り|らない|らず|って|った|ります|ました|ません|ませんでした)/ 50 | specs: 51 | - from: 受取る 52 | to: 受け取る 53 | - expected: お手数をおかけしますが 54 | patterns: お手数をお掛けしますが 55 | - expected: 問い合わせ 56 | patterns: 57 | - 問合わせ 58 | - 問合せ 59 | - expected: およそ 60 | patterns: 凡そ 61 | - expected: おもむろに 62 | patterns: 徐に 63 | - expected: および 64 | patterns: 及び 65 | - expected: 終わる 66 | patterns: 終る 67 | # か行 68 | - expected: かえって 69 | patterns: 却って 70 | - expected: かつ 71 | patterns: 且つ 72 | - expected: かもしれない 73 | patterns: かも知れない 74 | - expected: 切り替え 75 | patterns: 76 | - 切替 77 | - 切替え 78 | - 切換 79 | - 切り換え 80 | - expected: ください 81 | patterns: 下さい 82 | - expected: $1くらい 83 | patterns: /(人|件|冊)位/ 84 | specs: 85 | - from: 人位 86 | to: 人くらい 87 | - expected: ご$1 88 | patterns: /御(意見|確認|解約|参照|相談|注意|注文|登録|入力|予約|覧|了承|利用|連絡)/ 89 | specs: 90 | - from: 御意見 91 | to: ご意見 92 | - expected: ご存じ 93 | patterns: ご存知 94 | - expected: これほど 95 | patterns: これ程 96 | # さ行 97 | - expected: さきほど 98 | patterns: 先程 99 | - expected: さまざま 100 | patterns: 様々 101 | - expected: さらに 102 | patterns: /^更に/ 103 | specs: 104 | - from: 更に 105 | to: さらに 106 | - expected: しかし 107 | patterns: 然し 108 | - expected: しばらく 109 | patterns: 暫く 110 | - expected: すでに 111 | patterns: 既に 112 | - expected: すなわち 113 | patterns: 即ち 114 | - expected: すべて 115 | patterns: 全て 116 | - expected: せっかく 117 | patterns: 折角 118 | - expected: ぜひ 119 | patterns: 是非 120 | # た行 121 | - expected: たびたび 122 | patterns: 度々 123 | - expected: $1たび 124 | patterns: /(する|させる|される)度/ 125 | specs: 126 | - from: する度 127 | to: するたび 128 | - expected: できる 129 | patterns: 出来る 130 | - expected: たくさん 131 | patterns: 沢山 132 | - expected: ただ 133 | patterns: 只 134 | - expected: ただし 135 | patterns: 但し 136 | - expected: $1ため 137 | patterns: /(の|が|ある|する|させる|させない|される|しまう|いかない|とる|ない|受ける|使う)為/ 138 | specs: 139 | - from: の為 140 | to: のため 141 | - expected: 取り扱$1 142 | patterns: /取扱(い|う)/ 143 | specs: 144 | - from: 取扱い 145 | to: 取り扱い 146 | prh: 動詞の場合は「取り扱(い|う)」の形で送り仮名を入れます。ただし名詞の場合は「取扱(い)」でも構いません。 147 | # な行 148 | - expected: $1ない 149 | patterns: /(が|は|に|では|でも|関係|)無い/ 150 | specs: 151 | - from: が無い 152 | to: がない 153 | - expected: なお$1 154 | patterns: /尚(、|のこと)/ 155 | specs: 156 | - from: 尚、 157 | to: なお、 158 | - expected: なおさら 159 | patterns: 尚更 160 | - expected: なかなか 161 | patterns: 中々 162 | - expected: など 163 | patterns: 等 164 | - expected: ならびに 165 | patterns: 並びに 166 | - expected: のとおり 167 | patterns: の通り 168 | - expected: のよう$1 169 | patterns: /の様(に|な)/ 170 | specs: 171 | - from: の様に 172 | to: のように 173 | # は行 174 | - expected: はじめて 175 | patterns: 初めて 176 | - expected: ひな形 177 | patterns: 雛形 178 | # ま行 179 | - expected: まず 180 | patterns: 先ず 181 | - expected: また$1 182 | patterns: /又(、|は|の)/ 183 | specs: 184 | - from: 又は 185 | to: または 186 | - expected: まで 187 | patterns: 迄 188 | - expected: 見積$1 189 | patterns: /見積も(り|る)/ 190 | specs: 191 | - from: 見積もり 192 | to: 見積り 193 | - expected: 見積書 194 | patterns: /(見積り書|見積もり書)/ 195 | specs: 196 | - from: 見積り書 197 | to: 見積書 198 | - expected: むしろ 199 | patterns: 寧ろ 200 | - expected: めったに 201 | patterns: 滅多に 202 | - expected: もはや 203 | patterns: 最早 204 | - expected: 申し込み 205 | patterns: 申込み 206 | - expected: 申込書 207 | patterns: 208 | - 申し込み書 209 | - 申込み書 210 | - expected: 申込フォーム 211 | patterns: 212 | - 申し込みフォーム 213 | - 申込みフォーム 214 | - expected: 申し訳ございません 215 | patterns: 申し訳ありません 216 | - expected: もはや 217 | patterns: 最早 218 | # や行 219 | - expected: よほど 220 | patterns: 余程 221 | # わ行 222 | - expected: 私たち 223 | patterns: 私達 224 | - expected: をもって 225 | patterns: 226 | - を以て 227 | - を以って 228 | - expected: をもとに 229 | patterns: を基に 230 | # 句読点 231 | - expected: $1 232 | patterns: /(一方|なお|また)、/ 233 | specs: 234 | - from: また、 235 | to: また 236 | prh: 誤読や難読の恐れのある場合を除き、読点を省略します 237 | - expected: $1 238 | patterns: /、(「|『)/ 239 | specs: 240 | - from: 、「 241 | to: 「 242 | prh: 誤読や難読の恐れのある場合を除き、読点を省略します 243 | -------------------------------------------------------------------------------- /example/.textlintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "preset-bengo4": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "private": true, 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "textlint ./sample.md" 7 | }, 8 | "keywords": [], 9 | "license": "MIT", 10 | "dependencies": { 11 | "textlint": "^12.0.0", 12 | "textlint-rule-preset-bengo4": "file:.." 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /example/sample.md: -------------------------------------------------------------------------------- 1 | 原則として、校了後の原稿を変更できません。しかし、移転などにともなう情報の変更は随時受け付けておりますが、変更には最大2営業日かかる場合がございますので、ご了承ください。 -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "textlint-rule-preset-bengo4", 3 | "version": "2.2.2", 4 | "description": "弁護士ドットコムで使われているtextlintプリセット", 5 | "main": "lib/index.js", 6 | "author": "Bengo4.com, Inc.", 7 | "license": "MIT", 8 | "homepage": "https://github.com/bengo4/textlint-rule-preset-bengo4#readme", 9 | "scripts": { 10 | "example": "npm run build && cd example && npm it", 11 | "test": "textlint-scripts test", 12 | "build": "textlint-scripts build", 13 | "prepublishOnly": "npm run --if-present build", 14 | "semantic-release": "semantic-release" 15 | }, 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/bengo4/textlint-rule-preset-bengo4.git" 19 | }, 20 | "keywords": [ 21 | "textlint", 22 | "textlintrule", 23 | "bengo4" 24 | ], 25 | "dependencies": { 26 | "@textlint-rule/textlint-rule-no-unmatched-pair": "^1.0.8", 27 | "@textlint/module-interop": "^13.3.2", 28 | "textlint-rule-ja-hiragana-fukushi": "^1.3.0", 29 | "textlint-rule-ja-hiragana-hojodoushi": "^1.0.4", 30 | "textlint-rule-ja-hiragana-keishikimeishi": "^1.1.0", 31 | "textlint-rule-ja-no-redundant-expression": "^4.0.0", 32 | "textlint-rule-no-mix-dearu-desumasu": "^5.0.0", 33 | "textlint-rule-preset-japanese": "^7.0.0", 34 | "textlint-rule-preset-jtf-style": "^2.3.12", 35 | "textlint-rule-prh": "^5.3.0" 36 | }, 37 | "devDependencies": { 38 | "@commitlint/cli": "^17.0.1", 39 | "@commitlint/config-conventional": "^17.0.0", 40 | "@semantic-release/changelog": "^6.0.1", 41 | "@semantic-release/git": "^10.0.1", 42 | "@textlint/types": "^12.0.0", 43 | "@types/node": "^18.0.3", 44 | "husky": "^8.0.1", 45 | "prettier": "^2.3.2", 46 | "semantic-release": "^19.0.2", 47 | "textlint-scripts": "^12.0.1", 48 | "textlint-tester": "^13.3.2", 49 | "ts-node": "^10.0.0", 50 | "typescript": "^5.0.4" 51 | }, 52 | "commitlint": { 53 | "extends": [ 54 | "@commitlint/config-conventional" 55 | ] 56 | }, 57 | "husky": { 58 | "hooks": { 59 | "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" 60 | } 61 | }, 62 | "release": { 63 | "plugins": [ 64 | "@semantic-release/commit-analyzer", 65 | "@semantic-release/release-notes-generator", 66 | "@semantic-release/changelog", 67 | "@semantic-release/npm", 68 | "@semantic-release/github", 69 | "@semantic-release/git" 70 | ], 71 | "branches": [ 72 | "main" 73 | ] 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/@types/@textlint/@module-interop.d.ts: -------------------------------------------------------------------------------- 1 | declare module "@textlint/module-interop"; 2 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { moduleInterop } from "@textlint/module-interop"; 2 | 3 | const japanesePreset = moduleInterop(require("textlint-rule-preset-japanese")); 4 | const jtfPreset = moduleInterop(require("textlint-rule-preset-jtf-style")); 5 | 6 | module.exports = { 7 | rules: Object.assign( 8 | { 9 | "@textlint-rule/no-unmatched-pair": moduleInterop( 10 | require("@textlint-rule/textlint-rule-no-unmatched-pair") 11 | ), 12 | "ja-hiragana-fukushi": moduleInterop( 13 | require("textlint-rule-ja-hiragana-fukushi") 14 | ), 15 | "ja-hiragana-hojodoushi": moduleInterop( 16 | require("textlint-rule-ja-hiragana-hojodoushi") 17 | ), 18 | "ja-hiragana-keishikimeishi": moduleInterop( 19 | require("textlint-rule-ja-hiragana-keishikimeishi") 20 | ), 21 | "ja-no-redundant-expression": moduleInterop( 22 | require("textlint-rule-ja-no-redundant-expression") 23 | ), 24 | "no-mix-dearu-desumasu": moduleInterop( 25 | require("textlint-rule-no-mix-dearu-desumasu") 26 | ), 27 | prh: moduleInterop(require("./prh-rules")), 28 | }, 29 | japanesePreset.rules, 30 | jtfPreset.rules 31 | ), 32 | 33 | rulesConfig: Object.assign( 34 | japanesePreset.rulesConfig, 35 | jtfPreset.rulesConfig, 36 | { 37 | "@textlint-rule/no-unmatched-pair": true, 38 | "ja-hiragana-fukushi": true, 39 | "ja-hiragana-hojodoushi": true, 40 | "ja-hiragana-keishikimeishi": true, 41 | "ja-no-redundant-expression": true, 42 | "no-mix-dearu-desumasu": true, 43 | "3.1.1.全角文字と半角文字の間": false, 44 | prh: true, 45 | }, 46 | ), 47 | }; 48 | -------------------------------------------------------------------------------- /src/prh-rules.ts: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const prh = require("textlint-rule-prh"); 3 | 4 | const prhPaths = [ 5 | "/../dict/prh_mistakes.yml", 6 | "/../dict/prh_redundancy.yml", 7 | "/../dict/prh_bengo4.yml", 8 | "/../dict/prh_writing.yml", 9 | ]; 10 | 11 | const reporter = (context: any) => { 12 | return prh.fixer(context, { 13 | ruleContents: prhPaths.map((path) => 14 | fs.readFileSync(__dirname + path, "utf-8") 15 | ), 16 | }); 17 | }; 18 | 19 | module.exports = { 20 | linter: reporter, 21 | fixer: reporter, 22 | }; 23 | -------------------------------------------------------------------------------- /test/index-test.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | import assert from "assert"; 4 | import index from "../src/index"; 5 | 6 | describe("index-test", function () { 7 | context("rules", function () { 8 | it("should have default rulesConfig", function () { 9 | Object.keys(index.rules).forEach((ruleName) => { 10 | assert( 11 | index.rulesConfig[ruleName] !== undefined, 12 | `${ruleName} ref is undefined.` 13 | ); 14 | }); 15 | }); 16 | 17 | it("should not ref same function", function () { 18 | Object.keys(index.rules).forEach((ruleName) => { 19 | let rule = index.rules[ruleName]; 20 | Object.keys(index.rules).forEach((otherRuleName) => { 21 | if (otherRuleName !== ruleName) { 22 | assert( 23 | rule !== index.rules[otherRuleName], 24 | `${ruleName} !== ${otherRuleName}` 25 | ); 26 | } 27 | }); 28 | }); 29 | }); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "moduleResolution": "node", 5 | "esModuleInterop": true, 6 | "noEmit": true, 7 | "target": "es2015", 8 | "strict": true, 9 | "noUnusedLocals": true, 10 | "noUnusedParameters": true, 11 | "noImplicitReturns": true, 12 | "noFallthroughCasesInSwitch": true 13 | } 14 | } 15 | --------------------------------------------------------------------------------