1.0.2 • Published 10 months ago

textlint-rule-no-date-without-actual-date v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

npm test

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/v2.29.2/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

1.0.2

10 months ago

1.0.1

2 years ago

1.0.0

2 years ago