Skip to content
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

Add prefix to link name for readme config badge #259

Merged
merged 1 commit into from
Nov 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ While config emojis are the recommended representations of configs that a rule b
Here's a badge for a custom `fun` config that displays in blue:

```md
[fun]: https://img.shields.io/badge/-fun-blue.svg
[badge-fun]: https://img.shields.io/badge/-fun-blue.svg
```

And how it looks:

![fun][]
![badge-fun][]

[fun]: https://img.shields.io/badge/-fun-blue.svg
[badge-fun]: https://img.shields.io/badge/-fun-blue.svg

## Configuration options

Expand Down
2 changes: 1 addition & 1 deletion lib/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function findConfigEmoji(
)?.emoji;
if (!emoji) {
if (options?.fallback === 'badge') {
emoji = `![${configName}][]`;
emoji = `![badge-${configName}][]`;
} else {
// No fallback.
return undefined; // eslint-disable-line unicorn/no-useless-undefined
Expand Down
22 changes: 11 additions & 11 deletions test/lib/generate/__snapshots__/config-emoji-test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ exports[`generate (--config-emoji) basic shows the correct emojis 1`] = `
🔥 Set in the \`recommended\` configuration.\\
🎨 Set in the \`stylistic\` configuration.

| Name | Description | 💼 |
| :----------------------------- | :---------------------- | :------------------------- |
| [no-bar](docs/rules/no-bar.md) | Description for no-bar. | 🔥 🎨 |
| [no-baz](docs/rules/no-baz.md) | Description for no-boz. | ![configWithoutEmoji][] 🎨 |
| [no-foo](docs/rules/no-foo.md) | Description for no-foo. | 🔥 |
| Name | Description | 💼 |
| :----------------------------- | :---------------------- | :------------------------------- |
| [no-bar](docs/rules/no-bar.md) | Description for no-bar. | 🔥 🎨 |
| [no-baz](docs/rules/no-baz.md) | Description for no-boz. | ![badge-configWithoutEmoji][] 🎨 |
| [no-foo](docs/rules/no-foo.md) | Description for no-foo. | 🔥 |

<!-- end auto-generated rules list -->
"
Expand Down Expand Up @@ -51,9 +51,9 @@ exports[`generate (--config-emoji) removing default emoji for a config reverts t

💼 Configurations enabled in.

| Name | Description | 💼 |
| :----------------------------- | :---------------------- | :--------------- |
| [no-foo](docs/rules/no-foo.md) | Description for no-foo. | ![recommended][] |
| Name | Description | 💼 |
| :----------------------------- | :---------------------- | :--------------------- |
| [no-foo](docs/rules/no-foo.md) | Description for no-foo. | ![badge-recommended][] |

<!-- end auto-generated rules list -->
"
Expand All @@ -74,9 +74,9 @@ exports[`generate (--config-emoji) with one config that does not have emoji show

💼 Configurations enabled in.

| Name | Description | 💼 |
| :----------------------------- | :---------------------- | :---------------------- |
| [no-foo](docs/rules/no-foo.md) | Description for no-foo. | ![configWithoutEmoji][] |
| Name | Description | 💼 |
| :----------------------------- | :---------------------- | :---------------------------- |
| [no-foo](docs/rules/no-foo.md) | Description for no-foo. | ![badge-configWithoutEmoji][] |

<!-- end auto-generated rules list -->
"
Expand Down
18 changes: 9 additions & 9 deletions test/lib/generate/__snapshots__/configs-test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ exports[`generate (configs) rules that are disabled or set to warn generates the
🚫 Configurations disabled in.\\
✅ Set in the \`recommended\` configuration.

| Name | Description | 💼 | ⚠️ | 🚫 |
| :----------------------------- | :--------------------- | :- | :----------- | :----------- |
| [no-bar](docs/rules/no-bar.md) | Description of no-bar. | | | ![other][] ✅ |
| [no-baz](docs/rules/no-baz.md) | Description of no-baz. | ✅ | | ![other][] |
| [no-bez](docs/rules/no-bez.md) | Description of no-bez. | | ![other][] | |
| [no-biz](docs/rules/no-biz.md) | Description of no-biz. | | | ![other][] |
| [no-boz](docs/rules/no-boz.md) | Description of no-boz. | | ✅ | |
| [no-buz](docs/rules/no-buz.md) | Description of no-buz. | | ![other][] ✅ | |
| [no-foo](docs/rules/no-foo.md) | Description of no-foo. | | | ✅ |
| Name | Description | 💼 | ⚠️ | 🚫 |
| :----------------------------- | :--------------------- | :- | :----------------- | :----------------- |
| [no-bar](docs/rules/no-bar.md) | Description of no-bar. | | | ![badge-other][] ✅ |
| [no-baz](docs/rules/no-baz.md) | Description of no-baz. | ✅ | | ![badge-other][] |
| [no-bez](docs/rules/no-bez.md) | Description of no-bez. | | ![badge-other][] | |
| [no-biz](docs/rules/no-biz.md) | Description of no-biz. | | | ![badge-other][] |
| [no-boz](docs/rules/no-boz.md) | Description of no-boz. | | ✅ | |
| [no-buz](docs/rules/no-buz.md) | Description of no-buz. | | ![badge-other][] ✅ | |
| [no-foo](docs/rules/no-foo.md) | Description of no-foo. | | | ✅ |

<!-- end auto-generated rules list -->
"
Expand Down
10 changes: 5 additions & 5 deletions test/lib/generate/__snapshots__/sorting-test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ exports[`generate (sorting) sorting rules and configs case-insensitive sorts cor

💼 Configurations enabled in.

| Name | 💼 |
| :------------------- | :------------------- |
| [a](docs/rules/a.md) | ![a][] ![B][] ![c][] |
| [B](docs/rules/B.md) | |
| [c](docs/rules/c.md) | |
| Name | 💼 |
| :------------------- | :------------------------------------- |
| [a](docs/rules/a.md) | ![badge-a][] ![badge-B][] ![badge-c][] |
| [B](docs/rules/B.md) | |
| [c](docs/rules/c.md) | |

<!-- end auto-generated rules list -->
"
Expand Down
8 changes: 4 additions & 4 deletions test/lib/generate/__snapshots__/url-configs-test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ exports[`generate (--url-configs) basic includes the config link 1`] = `
💼 [Configurations](http://example.com/configs) enabled in.\\
✅ Set in the \`recommended\` [configuration](http://example.com/configs).

| Name | Description | 💼 |
| :----------------------------- | :---------------------- | :---------------- |
| [no-bar](docs/rules/no-bar.md) | Description for no-bar. | ![customConfig][] |
| [no-foo](docs/rules/no-foo.md) | Description for no-foo. | ✅ |
| Name | Description | 💼 |
| :----------------------------- | :---------------------- | :---------------------- |
| [no-bar](docs/rules/no-bar.md) | Description for no-bar. | ![badge-customConfig][] |
| [no-foo](docs/rules/no-foo.md) | Description for no-foo. | ✅ |

<!-- end auto-generated rules list -->
"
Expand Down