Skip to content

Instantly share code, notes, and snippets.

@ninoseki
Created October 1, 2018 04:06
Show Gist options
  • Save ninoseki/64fcb179b5702761c49612caf4a1b478 to your computer and use it in GitHub Desktop.
Save ninoseki/64fcb179b5702761c49612caf4a1b478 to your computer and use it in GitHub Desktop.
「テキスト校正くん」をインストールせずに vscode-textlint 経由で使う方法

Using テキスト校正くん without installing the VS Code extension

モチベーション

  • すでに vscode-textlint を使用しているので、二重に textlint を管理する extension をインストールしたくない。
  • 二重にインストールして使うと(textlint のプロセスが複数動く?ので)衝突する可能性があるのでは?
    • きちんと動作確認していないので、杞憂かも。

インストール

依存関係をインストールする。

npm install -g textlint-rule-max-ten textlint-rule-no-mix-dearu-desumasu textlint-rule-preset-japanese textlint-rule-preset-jtf-style textlint-rule-prh
npm install -g github:ics-creative/textlint-rule-preset-icsmedia

設定

~/.textlintrc に以下の設定をマージする。

{
  "filters": {},
  "rules": {
    "no-mix-dearu-desumasu": true,
    "preset-japanese": {
      "sentence-length": {
        "max": 150
      },
      "max-ten": {
        "max": 4
      },
      "no-doubled-joshi": {
        "min_interval" : 1,
        "strict": false,
        "allow": ["", "", ""],
        "separatorChars": ["", "", "?", "!", "", "", "",  "", "", ""]
      },
    },
    "preset-jtf-style": {
      "1.2.1.句点(。)と読点(、)": false,
      "1.2.2.ピリオド(.)とカンマ(,)": true,
      "2.1.8.算用数字": false,
      "2.2.2.算用数字と漢数字の使い分け": true,
      "3.1.1.全角文字と半角文字の間": false,
      "3.1.2.全角文字どうし": false,
      "4.1.3.ピリオド(.)、カンマ(,)": true,
      "4.3.2.大かっこ[]": true,
      "4.2.6.ハイフン(-)": true,
      "4.3.1.丸かっこ()": false
    },
    "prh": {
      "rulePaths": ["/usr/local/lib/node_modules/textlint-rule-preset-icsmedia/dict/prh.yml"]
    }
  }
}

以上です。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment