Skip to content

Commit

Permalink
Auto-format mdx
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Apr 3, 2024
1 parent 440d72b commit 161f5dc
Show file tree
Hide file tree
Showing 12 changed files with 129 additions and 77 deletions.
3 changes: 3 additions & 0 deletions packages/docs/src/content/docs/blog/knip-v3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,23 @@ Try out the latest Knip v3 release today!
```

</TabItem>

<TabItem label="pnpm">

```shell
pnpm add -D knip
```

</TabItem>

<TabItem label="bun">

```shell
bun add -D knip
```

</TabItem>

<TabItem label="yarn">

```shell
Expand Down
3 changes: 3 additions & 0 deletions packages/docs/src/content/docs/blog/knip-v4.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,23 @@ What are you waiting for? Start using Knip v4 today!
```

</TabItem>

<TabItem label="pnpm">

```shell
pnpm add -D knip
```

</TabItem>

<TabItem label="bun">

```shell
bun add -D knip
```

</TabItem>

<TabItem label="yarn">

```shell
Expand Down
9 changes: 6 additions & 3 deletions packages/docs/src/content/docs/blog/knip-v5.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ those exports explicitly:

```ts title="knip.js"
export const version = 'v5';
export const getRocket = () => 🚀;
export const getRocket = () => '🚀';
```

```ts title="index.js"
Expand Down Expand Up @@ -107,7 +107,7 @@ Using one of the available JSDoc tags like `@public` or `@internal`:
```ts title="knip.js"
export const version = 'v5';
/** @public */
export const getRocket = () => 🚀;
export const getRocket = () => '🚀';
```

Assuming only imported using a namespace (like in the example cases above), this
Expand All @@ -121,7 +121,7 @@ Another solution is to tag individual exports arbitrarily:
```ts title="knip.js"
export const version = 'v5';
/** @launch */
export const getRocket = () => 🚀;
export const getRocket = () => '🚀';
```

And then exclude the tag like so:
Expand Down Expand Up @@ -165,20 +165,23 @@ What are you waiting for? Start using Knip v5 today!
```

</TabItem>

<TabItem label="pnpm">

```shell
pnpm add -D knip
```

</TabItem>

<TabItem label="bun">

```shell
bun add -D knip
```

</TabItem>

<TabItem label="yarn">

```shell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ that's not easy to find. Here's an example of an export/import match that **is**
easy to find:

```ts title="import.ts"
import { MyThing } = './thing.ts';
import { MyThing } from './thing.ts';
```

```ts title="export.ts"
Expand Down
3 changes: 3 additions & 0 deletions packages/docs/src/content/docs/features/auto-fix.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,23 @@ Unused dependencies are removed from `package.json`:
```

</TabItem>

<TabItem label="pnpm">

```shell
pnpm install
```

</TabItem>

<TabItem label="bun">

```shell
bun install
```

</TabItem>

<TabItem label="yarn">

```shell
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/content/docs/features/reporters.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ supports a local JavaScript or TypeScript file or an external dependency.
The default export of the reporter should be a function with this interface:

```ts
type Reporter = async (options: ReporterOptions) => void;
type Reporter = async (options: ReporterOptions): void;

type ReporterOptions = {
report: Report;
Expand Down
18 changes: 10 additions & 8 deletions packages/docs/src/content/docs/guides/handling-issues.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ non-standard consumption of your exports? Here's an example:
```

</TabItem>

<TabItem label="components.js">

```ts
Expand All @@ -307,13 +308,13 @@ knip --include-libs
```

This comes at a performance and memory penalty, but should give better results
if you need it. This flag is implied when [classMembers](#class-members) are
included (that feature comes with roughly the same performance penalty).
if you need it. This flag is implied when [classMembers][18] are included (that
feature comes with roughly the same performance penalty).

### Missing Exports?

Do you expect certain exports in the report, but are they missing? They might be
exported from an entry file. Use [--include-entry-exports][18] to make Knip also
exported from an entry file. Use [--include-entry-exports][19] to make Knip also
report unused exports in entry files.

## Class Members
Expand All @@ -331,7 +332,7 @@ cases it may even run out of memory in large repositories).
Individual class members can be [tagged as `@public`][16].

Classes exported from entry files are ignored, and so are their members. Use
[--include-entry-exports][18] to make Knip also report members of unused export
[--include-entry-exports][19] to make Knip also report members of unused export
in entry files.

## Enum Members
Expand All @@ -346,14 +347,14 @@ knip --exclude enumMembers
Individual enum members can be [tagged as `@public`][16].

Enums exported from entry files are ignored, and so are their members. Use
[--include-entry-exports][18] to make Knip also report members of unused exports
[--include-entry-exports][19] to make Knip also report members of unused exports
in entry files.

## False Positives

If you believe Knip incorrectly reports something as unused (i.e. a false
positive), you can help your own project and help improve Knip by creating a
[minimal reproduction][19] and open an issue on GitHub.
[minimal reproduction][20] and open an issue on GitHub.

[1]: ../overview/configuration.md
[2]: ../explanations/entry-files.md
Expand All @@ -372,5 +373,6 @@ positive), you can help your own project and help improve Knip by creating a
[15]: ../reference/configuration.md#ignoreexportsusedinfile
[16]: ../reference/jsdoc-tsdoc-tags.md#public
[17]: ../reference/cli.md#--tags
[18]: ../reference/configuration.md#includeentryexports
[19]: ../guides/troubleshooting.md#minimal-reproduction
[18]: #class-members
[19]: ../reference/configuration.md#includeentryexports
[20]: ../guides/troubleshooting.md#minimal-reproduction
80 changes: 53 additions & 27 deletions packages/docs/src/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,40 @@ Using Knip at work? Please consider [sponsoring me][1]!

<CardGrid stagger>
<Card title="Getting Started" icon="rocket">

Read [getting started][2] to install and run Knip

</Card>

<Card title="Why Use Knip?" icon="approve-check">

Understand [what Knip can do for you][3]

</Card>

<Card title="Troubleshooting" icon="warning">

Need help? [Start troubleshooting here][4]

</Card>

<Card title="Plugins" icon="list-format">

Check out the [list of plugins][5]

</Card>
</CardGrid>

## 🧡 Introduction Video

[James Shopland](https://www.jamesshopland.com) created this great introduction
and overview of Knip:
[James Shopland][6] created this great introduction and overview of Knip:

<YouTube id="uhEkgWt-pUM" />

## 🧡 Sponsors

Big shoutout to the awesome companies and people sponsoring this project! See
[Sponsors](./sponsors) for the full list.
[Sponsors][7] for the full list.

<Sponsors direction="row" showAll={false} />

Expand All @@ -71,11 +81,11 @@ Special thanks to the wonderful people who have contributed to this project!
## 🧡 Articles

- Smashing Magazine: [Knip: An Automated Tool For Finding Unused Files, Exports,
And Dependencies][6]
And Dependencies][8]
- Effective TypeScript: [Recommendation Update: ✂️ Use knip to detect dead code
and types][7]
- Maddy Miller: [Using Knip to find dead code in a high-traffic git repo][8]
- Josh Goldberg: [Speeding Up Centered Part 4: Unused Code Bloat][9]
and types][9]
- Maddy Miller: [Using Knip to find dead code in a high-traffic git repo][10]
- Josh Goldberg: [Speeding Up Centered Part 4: Unused Code Bloat][11]

## 🧡 Testimonials

Expand All @@ -85,24 +95,24 @@ Special thanks to the wonderful people who have contributed to this project!

:::section{.columns.min300}

- [Argos](https://github.com/argos-ci/argos)
- [ESLint](https://github.com/eslint/eslint)
- [freeCodeCamp](https://github.com/freeCodeCamp/freeCodeCamp)
- [gajus/slonik](https://github.com/gajus/slonik)
- [JoshuaKGoldberg/create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app)
- [microsoft/DefinitelyTyped-tools](https://github.com/microsoft/DefinitelyTyped-tools)
- [Monkeytype](https://github.com/monkeytypegame/monkeytype)
- [Release It!](https://github.com/release-it/release-it)
- [sourcegraph/cody](https://github.com/sourcegraph/cody)
- [Svelte](https://github.com/sveltejs/svelte)
- [TanStack/query](https://github.com/TanStack/query)
- [TanStack/table](https://github.com/TanStack/table)
- [Tipi](https://github.com/runtipi/runtipi)
- [Wagmi](https://github.com/wevm/wagmi)
- [Argos][12]
- [ESLint][13]
- [freeCodeCamp][14]
- [gajus/slonik][15]
- [JoshuaKGoldberg/create-typescript-app][16]
- [microsoft/DefinitelyTyped-tools][17]
- [Monkeytype][18]
- [Release It!][19]
- [sourcegraph/cody][20]
- [Svelte][21]
- [TanStack/query][22]
- [TanStack/table][23]
- [Tipi][24]
- [Wagmi][25]

:::

Use [GitHub Search for `package.json` files containing "knip"][10] for more
Use [GitHub Search for `package.json` files containing "knip"][26] for more
projects and examples using Knip.

Have or know about a nice resource about or project using Knip? Feel free to
Expand All @@ -113,11 +123,27 @@ propose a change and add it to this page!
[3]: ./explanations/why-use-knip.md
[4]: ./guides/troubleshooting.md
[5]: ./reference/plugins.md
[6]:
[6]: https://www.jamesshopland.com
[7]: ./sponsors
[8]:
https://www.smashingmagazine.com/2023/08/knip-automated-tool-find-unused-files-exports-dependencies/
[7]: https://effectivetypescript.com/2023/07/29/knip/
[8]: https://madelinemiller.dev/blog/knip-dead-code/
[9]:
[9]: https://effectivetypescript.com/2023/07/29/knip/
[10]: https://madelinemiller.dev/blog/knip-dead-code/
[11]:
https://www.joshuakgoldberg.com/blog/speeding-up-centered-part-4-unused-code-bloat/
[10]:
[12]: https://github.com/argos-ci/argos
[13]: https://github.com/eslint/eslint
[14]: https://github.com/freeCodeCamp/freeCodeCamp
[15]: https://github.com/gajus/slonik
[16]: https://github.com/JoshuaKGoldberg/create-typescript-app
[17]: https://github.com/microsoft/DefinitelyTyped-tools
[18]: https://github.com/monkeytypegame/monkeytype
[19]: https://github.com/release-it/release-it
[20]: https://github.com/sourcegraph/cody
[21]: https://github.com/sveltejs/svelte
[22]: https://github.com/TanStack/query
[23]: https://github.com/TanStack/table
[24]: https://github.com/runtipi/runtipi
[25]: https://github.com/wevm/wagmi
[26]:
https://github.com/search?q=path%3A%2F%28%5E%7C%5C%2F%29package%5C.json%24%2F+knip&type=code
8 changes: 8 additions & 0 deletions packages/docs/src/content/docs/overview/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,23 @@ The recommended way to install Knip is by using your package manager:
```

</TabItem>

<TabItem label="pnpm">

```shell
pnpm add -D knip typescript @types/node
```

</TabItem>

<TabItem label="bun">

```shell
bun add -D knip typescript @types/node
```

</TabItem>

<TabItem label="yarn">

```shell
Expand Down Expand Up @@ -72,20 +75,23 @@ Now you can run Knip to lint your project:
```

</TabItem>

<TabItem label="pnpm">

```shell
pnpm knip
```

</TabItem>

<TabItem label="bun">

```shell
bun knip
```

</TabItem>

<TabItem label="yarn">

```shell
Expand All @@ -109,13 +115,15 @@ Alternatively, try Knip without adding it to your project:
```

</TabItem>

<TabItem label="pnpm">

```shell
pnpm dlx knip
```

</TabItem>

<TabItem label="bun">

```shell
Expand Down
Loading

0 comments on commit 161f5dc

Please sign in to comment.