VSCode+textlint
作業メモ
やりたいこと
- VSCodeで自動的に日本語が正しいかチェックしてほしい
前提
- macOS Mojave
- fish
やること
- nodenv導入
- textlint導入
- vscode-textlint導入
nodenv導入
GitHub - nodenv/nodenv: Manage multiple NodeJS versions.
mfham@mac ~> git clone https://github.com/nodenv/nodenv.git ~/.nodenv mfham@mac ~> cd ~/.nodenv && src/configure && make -C src mfham@mac ~> set -Ux fish_user_paths $HOME/.nodenv/bin $fish_user_paths mfham@mac ~> ~/.nodenv/bin/nodenv init mfham@mac ~> emacs ~/.config/fish/config.fish mfham@mac ~> tail -n 1 ~/.config/fish/config.fish status --is-interactive; and source (nodenv init -|psub)
GitHub - nodenv/node-build: Install NodeJS versions
mfham@mac ~> mkdir -p (nodenv root)/plugins mfham@mac ~> git clone https://github.com/nodenv/node-build.git (nodenv root)/plugins/node-build
mfham@mac ~> curl -fsSL https://github.com/nodenv/nodenv-installer/raw/master/bin/nodenv-doctor | bash Checking for `nodenv' in PATH: /Users/mfham/.nodenv/bin/nodenv Checking for nodenv shims in PATH: OK Checking `nodenv install' support: /Users/mfham/.nodenv/plugins/node-build/bin/nodenv-install (node-build 4.9.15) Counting installed Node versions: none There aren't any Node versions installed under `/Users/mfham/.nodenv/versions'. You can install Node versions like so: nodenv install 2.2.4 Auditing installed plugins: OK
mfham@mac ~> nodenv install 14.15.0 mfham@mac ~> nodenv global 14.15.0 mfham@mac ~> node --version v14.15.0 mfham@mac ~> npm --version 6.14.8
textlint導入
GitHub - textlint/textlint: The pluggable natural language linter for text and markdown.
mfham@mac ~/w/document> pwd /Users/mfham/work/document mfham@mac ~/w/document> npm init --yes mfham@mac ~/w/document> npm install --save-dev textlint # 好きなルールをインストール mfham@mac ~/w/document> npm install --save-dev textlint-rule-preset-ja-technical-writing textlint-rule-preset-jtf-style textlint-rule-ja-hiragana-keishikimeishi textlint-rule-ja-hiragana-fukushi textlint-rule-ja-hiragana-hojodoushi textlint-rule-prh mfham@mac ~/w/document> ./node_modules/.bin/textlint --init mfham@mac ~/w/document> cat .textlintrc { "filters": {}, "rules": { "ja-hiragana-fukushi": true, "ja-hiragana-hojodoushi": true, "ja-hiragana-keishikimeishi": true, "preset-ja-technical-writing": true, "preset-jtf-style": true, "prh": true } } mfham@mac ~/w/document> git clone https://github.com/prh/rules.git mfham@mac ~/w/document> emacs .textlintrc mfham@mac ~/w/document> cat .textlintrc { "filters": {}, "rules": { "ja-hiragana-fukushi": true, "ja-hiragana-hojodoushi": true, "ja-hiragana-keishikimeishi": true, "preset-ja-technical-writing": true, "preset-jtf-style": true, "prh": { "rulePaths" : [ "/Users/mfham/work/document/rules/media/WEB+DB_PRESS.yml" ] } } }
vscode-textlint導入
vscode-textlint - Visual Studio Marketplace
インストールして、Settingsで次のように値を設定する。
Config Path: /Users/mfham/work/document/.textlintrc Node Path: /Users/mfham/work/document/node_modules