Skip to content

feat(space-between-half-and-full-width): add an option to ignore numbers and apply only to alphabets #45

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

Merged
merged 16 commits into from
Jan 23, 2023

Conversation

Sean0628
Copy link
Contributor

@Sean0628 Sean0628 commented Jan 17, 2023

This PR tries to add an option to ignore numbers and apply only to alphabets.

Refs #40

変更点

  • spaceオプションにスペースを入れる対象の配列を指定できるように
    • "space": ["alphabets", "numbers", "punctuation"] でアルファベット、数値、句読点の前後にスペースを入れる("space": "always"と同じ意味)
    • "space": ["alphabets", "punctuation"] とすると アルファベットと句読点の前後にスペースを入れる
    • "space": [] で全てにスペースを入れない("space": "never"と同じ意味)
  • exceptPunctuation オプションは "space": ["alphabets", "numbers"]で代用できるため、非推奨となりました

TEST

// .textlintrc.json
{
    "rules": {
        "ja-space-between-half-and-full-width": {
            "space": "always",
            "ignoreNumbers": true
        }
    }
}
## テスト

2022年7月7日、本日は晴天なり。
りんごは英語でAppleという。
>>> npx textlint old.md --fix

/Users/sho0628/projects/textlint_test/old.md
  4:7   ✔   原則として、全角文字と数字以外の半角文字の間にスペースを入れます。  ja-space-between-half-and-full-width
  4:12  ✔   原則として、全角文字と数字以外の半角文字の間にスペースを入れます。  ja-space-between-half-and-full-width

✔ Fixed 2 problems

@azu azu added the Type: Feature New Feature label Jan 22, 2023
update README.md
- modify the description about exceptPunctuation option
refactor parseSpaceOption
  - rename variables
  - assign userOptions with Object.fromEntries
Copy link
Member

@azu azu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

ありがとうございます

@azu azu merged commit 4eec7ed into textlint-ja:master Jan 23, 2023
@azu
Copy link
Member

azu commented Jan 23, 2023

@Sean0628 Sean0628 deleted the feature/add_ignore_numbers_option branch January 23, 2023 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants