Awesome
textlint-rule-no-date-without-actual-date
textlint rule that disallow date without actual date.
Like:
今日確認予定
Sometime, 今日
is required to be 今日(<actual-date>)
.
Install
Install with npm:
$ npm install textlint-rule-no-date-without-actual-date
Usage
Via .textlintrc
(Recommended)
{
"rules": {
"no-date-without-actual-date": {
"lang": "ja",
"markers": [
{ "str": "今日", "format": "MM/dd" },
{ "str": "明日", "format": "MM/dd", "duration": { "days": 1 } },
{ "str": "今週", "format": "MM/dd週", "convertToWeekStart": true }
]
}
}
}
The fields lang
and markers
are needed.
lang
is used for Intl.Segmenter
. (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter/Segmenter)
markers
is used for calculate date by date-fns
. (see https://date-fns.org/docs/format)
Build
Builds source codes for publish to the lib
folder.
You can write ES2015+ source codes in src/
folder.
$ npm run build
Tests
Run test code in test
folder.
Test textlint rule by textlint-tester.
$ npm test
License
MIT