Skip to content

Conversation

Leko
Copy link
Contributor

@Leko Leko commented Aug 7, 2021

I added an option so that users could use the same terminology throughout the documents.
We can make this a fixable rule as we know the acceptable term.

This is not a breaking change.

README.md Outdated
* 定義された見出し語以外の同義語をエラーにします
* 例) ["ユーザー"] // => 「ユーザー」だけ許可し「ユーザ」などはエラーにする
*/
allowsOnly?: string[];
Copy link
Member

@azu azu Aug 7, 2021

Choose a reason for hiding this comment

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

another options?

  • preferWords
  • dict
  • myWords

他のallowはtrueなら無視する感じなので、allowじゃない方が良い気がします。
あんまりいいものが思いついてないですが

Copy link
Contributor Author

Choose a reason for hiding this comment

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

preferWordsいいですね!リネームします。

@Leko Leko force-pushed the feat-allows-only branch 2 times, most recently from db3b9df to 0658f9f Compare August 8, 2021 01:06
@Leko Leko changed the title Propose: add allowsOnly option Propose: add preferWords option Aug 8, 2021
@Leko Leko requested a review from azu August 8, 2021 01:08
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.

Thanks for PR!

Almost LGTM

@@ -87,7 +95,19 @@ const report: TextlintRuleReporter<Options> = (context, options = {}) => {
allowAlphabet,
allowNumber
});
if (items.length >= 2) {
const allowedTerm = preferWords.find(midashi => itemGroup.getItem(midashi))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const allowedTerm = preferWords.find(midashi => itemGroup.getItem(midashi))
const preferWord = preferWords.find(midashi => itemGroup.getItem(midashi))

@Leko Leko force-pushed the feat-allows-only branch from 0658f9f to 185e796 Compare August 8, 2021 02:53
@Leko Leko requested a review from azu August 8, 2021 02:54
@azu azu merged commit 7ba481a into textlint-ja:master Aug 8, 2021
@Leko Leko deleted the feat-allows-only branch August 8, 2021 03:09
@azu
Copy link
Member

azu commented Aug 8, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants