Skip to content

Commit

Permalink
build(packages/remark-lint-list-item-style): explicitly rebuild distr…
Browse files Browse the repository at this point in the history
…ibutables
  • Loading branch information
Xunnamius committed Dec 22, 2022
1 parent 436108b commit fe903a6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
7 changes: 4 additions & 3 deletions packages/remark-lint-list-item-style/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ Options type for the remark-lint-list-item-style plugin.
| `checkFirstWord?` | typeof [`optionsCheckFirstWord`](README.md#optionscheckfirstword)[`number`] | Checks that the first word of each stringified list item paragraph begins with a non-lowercase character (`"capitalize"`) or a non-uppercase character (`"lowercase"`). List items beginning with a link, image, or inline code block are ignored. **`Default`** "capitalize" |
| `checkListSpread?` | typeof [`optionsCheckListSpread`](README.md#optionschecklistspread)[`number`] | Determines how `checkPunctuation` is applied to list items with spread children. Has no effect when `checkPunctuation` is `false`. **`Default`** "each" |
| `checkPunctuation?` | ``false`` \| (`string` \| `RegExp`)[] | Checks that the final character of each stringified list item matches at least one of the given values. To match all unicode punctuation characters, you could provide `["\p{P}"]` instead of the default, but this will match characters like `)` and `]`. Alternatively, to prevent punctuation, you could provide `["\P{P}"]`. Lines that consist solely of an image are ignored. **`Default`** ["(\\.\|\\?\|;\|,\|!)"] |
| `ignoredFirstWords?` | (`string` \| `RegExp`)[] | Words that would normally be checked with respect to the `checkFirstWord` option will be ignored if they match at least one of the given values. Use this option to prevent false positives (e.g. "iOS", "eBay"). **`Default`** [] |

#### Defined in

[packages/remark-lint-list-item-style/src/index.ts:29](https://github.com/Xunnamius/unified-utils/blob/dcdf185/packages/remark-lint-list-item-style/src/index.ts#L29)
[packages/remark-lint-list-item-style/src/index.ts:29](https://github.com/Xunnamius/unified-utils/blob/436108b/packages/remark-lint-list-item-style/src/index.ts#L29)

## Variables

Expand All @@ -47,7 +48,7 @@ Valid values for the Options.checkFirstWord property.

#### Defined in

[packages/remark-lint-list-item-style/src/index.ts:14](https://github.com/Xunnamius/unified-utils/blob/dcdf185/packages/remark-lint-list-item-style/src/index.ts#L14)
[packages/remark-lint-list-item-style/src/index.ts:14](https://github.com/Xunnamius/unified-utils/blob/436108b/packages/remark-lint-list-item-style/src/index.ts#L14)

___

Expand All @@ -59,7 +60,7 @@ Valid values for the Options.checkListSpread property.

#### Defined in

[packages/remark-lint-list-item-style/src/index.ts:19](https://github.com/Xunnamius/unified-utils/blob/dcdf185/packages/remark-lint-list-item-style/src/index.ts#L19)
[packages/remark-lint-list-item-style/src/index.ts:19](https://github.com/Xunnamius/unified-utils/blob/436108b/packages/remark-lint-list-item-style/src/index.ts#L19)

## Functions

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 1.0

- iOS SDK first version
- Android SDK first version
26 changes: 25 additions & 1 deletion packages/remark-lint-list-item-style/test/unit-index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,37 @@ describe('::default', () => {
expect.hasAssertions();

const results = await runLinter(
remark().use(remarkLintListItemStyle, { ignoredFirstWords: [/^n/, '^bar', 'qux'] })
remark().use(remarkLintListItemStyle, {
checkFirstWord: 'capitalize',
checkPunctuation: false,
ignoredFirstWords: [/^n/, '^bar', 'qux']
})
);

expect(results.okFirstWord.messages).toStrictEqual([]);
expect(results.notOkFirstWord.messages).toStrictEqual([]);

expect(results.okIgnoredFirstWords.messages).toStrictEqual([
expect.objectContaining({
message: 'Inconsistent list item capitalization: "i" should be "I"'
})
]);

expect(results.notOkFirstWordSpread.messages).toStrictEqual([
expect.objectContaining({
message: 'Inconsistent list item capitalization: "q" should be "Q"'
})
]);

const results2 = await runLinter(
remark().use(remarkLintListItemStyle, {
checkFirstWord: 'capitalize',
checkPunctuation: false,
ignoredFirstWords: ['iOS']
})
);

expect(results2.okIgnoredFirstWords.messages).toStrictEqual([]);
});

it("warns when a list item's punctuation violates multi-element checkPunctuation configuration", async () => {
Expand Down Expand Up @@ -287,6 +307,9 @@ async function runLinter(runner: Processor) {
);

const okFirstWord = await runner.process(await getFixtureVFile('ok-first-word'));
const okIgnoredFirstWords = await runner.process(
await getFixtureVFile('ok-ignored-first-words')
);
const okPunctuation = await runner.process(await getFixtureVFile('ok-punctuation'));
const okSpreadFirst = await runner.process(await getFixtureVFile('ok-spread-first'));
const okSpreadFirstAndFinal = await runner.process(
Expand All @@ -304,6 +327,7 @@ async function runLinter(runner: Processor) {
notOkPunctuation,
notOkSpreadEach,
okFirstWord,
okIgnoredFirstWords,
okPunctuation,
okSpreadFirst,
okSpreadFirstAndFinal,
Expand Down

0 comments on commit fe903a6

Please sign in to comment.