Skip to content

Commit

Permalink
Merge pull request #259 from bmish/badge-prefix
Browse files Browse the repository at this point in the history
Add prefix to link name for readme config badge
  • Loading branch information
bmish committed Nov 19, 2022
2 parents beb8647 + 2b11f63 commit 57997d5
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 33 deletions.
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

0 comments on commit 57997d5

Please sign in to comment.