-
Notifications
You must be signed in to change notification settings - Fork 4
Propose: add preferWords option #9
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
Conversation
README.md
Outdated
* 定義された見出し語以外の同義語をエラーにします | ||
* 例) ["ユーザー"] // => 「ユーザー」だけ許可し「ユーザ」などはエラーにする | ||
*/ | ||
allowsOnly?: string[]; |
There was a problem hiding this comment.
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じゃない方が良い気がします。
あんまりいいものが思いついてないですが
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preferWords
いいですね!リネームします。
db3b9df
to
0658f9f
Compare
There was a problem hiding this 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
src/textlint-rule-no-synonyms.ts
Outdated
@@ -87,7 +95,19 @@ const report: TextlintRuleReporter<Options> = (context, options = {}) => { | |||
allowAlphabet, | |||
allowNumber | |||
}); | |||
if (items.length >= 2) { | |||
const allowedTerm = preferWords.find(midashi => itemGroup.getItem(midashi)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const allowedTerm = preferWords.find(midashi => itemGroup.getItem(midashi)) | |
const preferWord = preferWords.find(midashi => itemGroup.getItem(midashi)) |
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.