Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Oct 2, 2024
1 parent 2ed9e51 commit b384403
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 34 deletions.
1 change: 1 addition & 0 deletions packages/docs/src/components/Projects.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<li><a href="https://github.com/nuxt/nuxt">Nuxt</a></li>
<li><a href="https://github.com/prettier/prettier">Prettier</a></>
<li><a href="https://github.com/release-it/release-it">Release It!</a></>
<li><a href="https://github.com/storybookjs/storybook">Storybook</a></li>
<li><a href="https://github.com/sveltejs/svelte">Svelte</a></li>
<li><a href="https://github.com/TanStack/query">Query</a>, <a href="https://github.com/TanStack/table">Table</a> (TanStack)</li>
<li><a href="https://github.com/microsoft/TypeScript">TypeScript (Microsoft)</a></li>
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/src/content/docs/explanations/why-use-knip.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ consider comments like the following:
```

Maybe you wonder why Knip does not have similar comments like `// knip-ignore`
so you can easily get rid of false positives? A variety of reasons:
so you can get rid of false positives? A variety of reasons:

1. A false positive may be a bug in Knip, and should be reported (not easily
1. A false positive may be a bug in Knip, and should be reported (not
dismissed).
2. Instead of proprietary comments, use [standardized annotations][11] serving
as documentation as well.
Expand Down
10 changes: 5 additions & 5 deletions packages/docs/src/content/docs/features/reporters.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ Markdown tables separated by issue types as headings, for example:

## Custom Reporters

When the provided built-in reporters are not quite sufficient, a custom local
reporter can be implemented or an external reporter can be used. Multiple
reporters can be used at once by repeating the `--reporter` argument.
When the provided built-in reporters are not sufficient, a custom local reporter
can be implemented or an external reporter can be used. Multiple reporters can
be used at once by repeating the `--reporter` argument.

The results are passed to the function from its default export and can be used
to write issues to `stdout`, a JSON or CSV file, or sent to a service. It
Expand Down Expand Up @@ -166,8 +166,8 @@ A preprocessor is a function that runs after the analysis is finished. It
receives the results from the analysis and should return data in the same
shape/structure (unless you pass it to only your own reporter).

The data goes through the preprocessor(s) before the final data is passed to the
reporter(s). There are no built-in preprocessors. Just like reporters, use e.g.
The data goes through the preprocessors before the final data is passed to the
reporters. There are no built-in preprocessors. Just like reporters, use e.g.
`--preprocessor ./my-preprocessor` from the command line (can be repeated).

The default export of the preprocessor should be a function with this interface:
Expand Down
41 changes: 21 additions & 20 deletions packages/docs/src/content/docs/guides/issue-reproduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ If you encounter an issue or false positives when using Knip, you can [open an
issue on GitHub][1]. This will help you in your project, and will also improve
Knip for everyone else!

There are many factors that may influence the issue at hand, such as:
Think of Knip like a kitchen sink, it handles a large amount of projects and
configurations, and your project is different from all others. Many factors may
influence the issue at hand, such as:

- Code syntax, import and export structure in source files
- Dependencies, scripts and entry files in `package.json`
Expand All @@ -15,16 +17,11 @@ There are many factors that may influence the issue at hand, such as:
- Dependent or depending workspaces in a monorepo
- Knip configuration in `knip.json`

Think of Knip like a kitchen sink, it handles a large amount of projects and
configurations, and your project is different from all others. That's why it's
required to provide a minimal reproduction. This contains only the source code
and configuration required to demonstrate the issue. Providing this with a clear
issue description will help us help you, and greatly improves the chances your
issue will be looked into efficiently and in a timely manner.

Issues containing just a screenshot, a snippet of output, or a snippet of source
code don't tell the full picture. Only an actual reproduction of the issue with
source code and configuration is complete and actionable.
That's why it's required to provide a minimal reproduction: only the source code
and configuration required to reproduce and demonstrate the issue. This makes it
easier to reason about, discuss further and work with. Providing this with an
issue description will help us help you and improve the chances the issue can be
looked into efficiently and in a timely manner.

## Before opening an issue

Expand All @@ -40,7 +37,7 @@ tracked separately.

## Templates

A convenient way to create a minimal reproduction so is by starting with one of
A convenient way to create a minimal reproduction is by starting with one of
these templates in CodeSandbox or StackBlitz:

| Template | | |
Expand All @@ -51,18 +48,21 @@ these templates in CodeSandbox or StackBlitz:
Shoutout to [CodeSandbox][7] and [StackBlitz][8] for generously providing these
free dev containers!

## Alternatives

Other solutions may work well too. For instance, many people choose to create a
small repository on GitHub. The goal is to have an easy and common understanding
and reproduction.

Providing a link to your existing project repository will likely not be
considered "minimal".
and reproduction. A link to your existing project repository will likely not be
considered "minimal". Issues containing just a screenshot, or snippets of output
or source code don't provide the full picture and aren't complete nor
actionable. If you're unable to create a reproduction using one of the methods
described then please clearly explain this in the issue or [contact me][9].

## Pull Request

The optimal way is to add fixtures and/or failing tests to the Knip repository,
and open a pull request to discuss the issue! Also see [instructions for
development][9].
The optimal way is to add fixtures and failing tests to the Knip repository, and
open a pull request to discuss the issue! Also see [instructions for
development][10].

[1]: https://github.com/webpro-nl/knip/issues?q=is%3Aissue
[2]: https://knip.dev/reference/known-issues
Expand All @@ -76,4 +76,5 @@ development][9].
https://stackblitz.com/github/webpro-nl/knip/tree/main/templates/issue-reproduction/monorepo
[7]: https://codesandbox.io
[8]: https://stackblitz.com
[9]: https://github.com/webpro-nl/knip/blob/main/.github/DEVELOPMENT.md
[9]: https://github.com/webpro
[10]: https://github.com/webpro-nl/knip/blob/main/.github/DEVELOPMENT.md
6 changes: 3 additions & 3 deletions packages/docs/src/content/docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ Available [issue types][13] when filtering output using `--include` or

### `--exclude`

Exclude provided issue type(s) from report. Can be comma-separated or repeated.
Exclude provided issue types from report. Can be comma-separated or repeated.

Example:

Expand All @@ -237,7 +237,7 @@ knip --exclude classMembers --exclude enumMembers

### `--include`

Report only provided issue type(s). Can be comma-separated or repeated.
Report only provided issue types. Can be comma-separated or repeated.

Example:

Expand Down Expand Up @@ -333,7 +333,7 @@ knip --reporter codeowners --reporter-options '{"path":".github/CODEOWNERS"}'

### `--preprocessor [preprocessor]`

Preprocess the results before providing it to the reporter(s).
Preprocess the results before providing it to the reporters.

Can be repeated. Examples:

Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/content/docs/reference/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ dependencies.
Knip includes basic "compilers" for a few common file types (Astro, MDX, Svelte,
Vue). Knip does not include actual compilers for reasons of potential
incompatibility with the existing compiler, and dependency size. Knip allows to
override them with the compiler(s) in your project, and add additional ones for
override them with the compilers in your project, and add additional ones for
other file types.

### Why are the exports of my `.vue` files not used?
Expand Down
5 changes: 3 additions & 2 deletions packages/docs/src/content/docs/reference/unsupported.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This page is an overview of related features Knip does not support.
## Unused variables

Knip doesn't look for unused variables within a file. It looks for exported and
imported values and types.
imported values and types across files.

Use [ESLint][1], [Biome][2] or [oxc][3] to find unused variables within files.

Expand All @@ -17,7 +17,8 @@ Knip does not yet support finding unused members of types, interfaces and
objects. This includes returned objects from exported functions and objects
passed as React component props.

Knip does support finding unused members of enums and classes.
Knip does support finding unused members of enums and classes, and exported
values and types on imported namespaces.

## Circular dependencies

Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/pages/sponsors.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Tweets from '../components/Tweets.astro';
<article class="sponsors-body">
<div class="column">
<p>
Knip is a powerful tool that helps hundreds of developers keep their
Knip is a powerful tool that helps thousands of developers keep their
JavaScript and TypeScript projects lean and maintainable. By identifying
unused files, dependencies and exports, Knip saves teams valuable time.
</p>
Expand Down

0 comments on commit b384403

Please sign in to comment.