Skip to content

Commit

Permalink
feat: add ja-space-around-link to preset (#53)
Browse files Browse the repository at this point in the history
* feat: add ja-space-around-link to preset

- 無効の状態で追加する

* feat(website): add website

* update readme

* update readme

* CI: use latest

* CI: update CI
  • Loading branch information
azu authored Jul 17, 2023
1 parent 8b28fbc commit 6d51772
Show file tree
Hide file tree
Showing 10 changed files with 2,096 additions and 40 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ env:
jobs:
test:
name: "Test on Node.js ${{ matrix.node_version }}"
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 12, 14, 16 ]
node-version: [ 16, 18, 20 ]
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: setup Node ${{ matrix.node_version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
- name: Install
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: website
on:
push:
branches:
- master
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Set Env
run: |
echo "OWNER_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $1}')" >> $GITHUB_ENV
echo "REPO_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}')" >> $GITHUB_ENV
echo "CURRENT_VERSION=$(node -p 'require("./package.json").version')" >> $GITHUB_ENV
- name: Install
run: yarn install
- name: Build
run: |
yarn install
npm run website -- --metadataVersion="${CURRENT_VERSION}"
env:
OWNER_NAME: ${{ env.OWNER_NAME }}
REPO_NAME: ${{ env.REPO_NAME }}
CURRENT_VERSION: ${{ env.CURRENT_VERSION }}
working-directory: website/
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./website/dist
37 changes: 22 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,12 @@ textlint --preset preset-ja-spacing README.md
### [textlint-rule-ja-space-between-half-and-full-width](./packages/textlint-rule-ja-space-between-half-and-full-width)

半角文字と全角文字の間にスペースを入れるかどうかのルール。
デフォルトはスペースを入れない。

### [textlint-rule-ja-space-around-code](./packages/textlint-rule-ja-space-around-code)

インラインコードの周りにスペースを入れるかを決めるルール
デフォルトでは、スペースを入れません。

### [textlint-rule-ja-no-space-between-full-width](./packages/textlint-rule-ja-no-space-between-full-width)

全角文字同士の間のスペースについてのtextlintルール。
全角文字どうしの間にスペースを入れません。
デフォルトでは、全角文字どうしの間にスペースを入れません。

### [textlint-rule-ja-nakaguro-or-halfwidth-space-between-katakana](packages/textlint-rule-ja-nakaguro-or-halfwidth-space-between-katakana)

Expand All @@ -68,6 +64,16 @@ textlint --preset preset-ja-spacing README.md
文末に疑問符を使用し、後に別の文が続く場合は、直後に全角スペースを挿入します。
文中に疑問符を使用する場合はスペースを挿入しません。

### [textlint-rule-ja-space-around-code](packages/textlint-rule-ja-space-around-code)

インラインコードの周りをスペースで囲むかどうかを決めるルール。
デフォルトでは、インラインコードの周りをスペースで囲みません。

### [textlint-rule-ja-space-around-link](packages/textlint-rule-ja-space-around-link)

リンクの周りをスペースで囲むかどうかを決めるルール。
デフォルトでは、リンクの周りをスペースで囲みません。

## デフォルト設定

デフォルトでは、次のような設定になっています。
Expand All @@ -85,24 +91,26 @@ textlint --preset preset-ja-spacing README.md
"ja-space-after-exclamation": true,
"ja-space-after-question": true,
"ja-space-around-code": false,
"ja-space-around-link": false
}
}
}
```

またデフォルトでは、[textlint-rule-ja-space-around-code](https://github.com/textlint-ja/textlint-rule-preset-ja-spacing/tree/master/packages/textlint-rule-ja-space-around-code)は無効になっています。
またデフォルトでは、次のルールは無効の状態でプリセットに含まれています。

- [textlint-rule-ja-space-around-code](https://github.com/textlint-ja/textlint-rule-preset-ja-spacing/tree/master/packages/textlint-rule-ja-space-around-code)
- [textlint-rule-ja-space-around-link](https://github.com/textlint-ja/textlint-rule-preset-ja-spacing/tree/master/packages/textlint-rule-ja-space-around-link)

次のように設定することで、`textlint-rule-ja-space-around-code`のルールを有効にできます
ルールのオプションについての詳細は[textlint-rule-ja-space-around-code](https://github.com/textlint-ja/textlint-rule-preset-ja-spacing/tree/master/packages/textlint-rule-ja-space-around-code)のREADMEを参照してください
次のように設定することで、ルールを有効にできます
ルールのオプションについての詳細はそれぞれのパッケージのREADMEを参照してください

```json
{
"rules": {
"preset-ja-spacing": {
"ja-space-around-code": {
"before": false,
"after": false
}
"ja-space-around-code": true,
"ja-space-around-link": true
}
}
}
Expand All @@ -113,8 +121,7 @@ textlint --preset preset-ja-spacing README.md
JTFスタイルガイドに含まれているルールと大部分は共通しています。
以下のプリセットを利用している場合は重複するルールがあります。

- [JTF日本語標準スタイルガイド(翻訳用)](https://www.jtf.jp/tips/styleguide "JTF日本語標準スタイルガイド(翻訳用)")
- [azu/textlint-rule-preset-JTF-style: JTF日本語標準スタイルガイド for textlint.](https://github.com/azu/textlint-rule-preset-JTF-style "azu/textlint-rule-preset-JTF-style: JTF日本語標準スタイルガイド for textlint.")
- [textlint-rule-preset-JTF-style: JTF日本語標準スタイルガイド for textlint.](https://github.com/azu/textlint-rule-preset-JTF-style "azu/textlint-rule-preset-JTF-style: JTF日本語標準スタイルガイド for textlint.")

## 開発フロー

Expand Down
1 change: 0 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"lerna": "2.0.0-beta.24",
"version": "2.3.0",
"useWorkspaces": true,
"npmClient": "yarn"
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"private": true,
"workspaces": [
"packages/*"
"packages/*",
"website"
],
"devDependencies": {
"lerna": "6.4.1"
Expand Down
1 change: 1 addition & 0 deletions packages/textlint-rule-preset-ja-spacing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"textlint-rule-ja-space-after-exclamation": "^2.2.0",
"textlint-rule-ja-space-after-question": "^2.2.0",
"textlint-rule-ja-space-around-code": "^2.2.0",
"textlint-rule-ja-space-around-link": "^2.2.0",
"textlint-rule-ja-space-between-half-and-full-width": "^2.3.0"
}
}
4 changes: 3 additions & 1 deletion packages/textlint-rule-preset-ja-spacing/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = {
"ja-space-after-exclamation": require("textlint-rule-ja-space-after-exclamation"),
"ja-space-after-question": require("textlint-rule-ja-space-after-question"),
"ja-space-around-code": require("textlint-rule-ja-space-around-code"),
"ja-space-around-link": require("textlint-rule-ja-space-around-link"),
},
rulesConfig: {
"ja-nakaguro-or-halfwidth-space-between-katakana": true,
Expand All @@ -20,5 +21,6 @@ module.exports = {
"ja-space-after-exclamation": true,
"ja-space-after-question": true,
"ja-space-around-code": false,
"ja-space-around-link": false,
}
};
};
8 changes: 8 additions & 0 deletions website/.textlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"filters": {
"comments": true
},
"rules": {
"preset-ja-spacing": true
}
}
18 changes: 18 additions & 0 deletions website/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"private": true,
"name": "website",
"version": "5.0.0",
"homepage": "https://github.com/textlint-ja/textlint-rule-preset-ja-spacing",
"scripts": {
"textlint": "textlint ../README.md",
"textlint:fix": "textlint --fix ../README.md",
"test": "npm run textlint",
"website": "textlint-website-generator --output-dir ./dist"
},
"devDependencies": {
"@textlint/website-generator": "^0.15.0",
"textlint": "^13.3.3",
"textlint-filter-rule-comments": "^1.2.2",
"textlint-rule-preset-ja-spacing": "^2.3.0"
}
}
Loading

0 comments on commit 6d51772

Please sign in to comment.