Skip to content

Commit

Permalink
Edit docs + add note to nuxt plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Aug 31, 2024
1 parent 9a11e1c commit 3e0c464
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
19 changes: 11 additions & 8 deletions packages/docs/src/content/docs/explanations/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ sidebar:
This page describes why Knip uses plugins and the difference between `config`
and `entry` files.

Knip has an extensive and growing [list of built-in plugins][1]. It's currently
not possible to add custom plugins.
Knip has an extensive and growing [list of built-in plugins][1]. Currently it's
not possible to add custom plugins, but feel free to [request a plugin][2] or
even [write a plugin][3] so others can benefit too.

## Enabled

Expand All @@ -18,14 +19,14 @@ in `package.json`. For instance, if `astro` is listed in `dependencies` or

## Configuration files

Knip uses [entry files][2] as starting points to scan your source code and
Knip uses [entry files][4] as starting points to scan your source code and
resolve other internal files and external dependencies. The dependency graph can
be statically resolved through the `require` and `import` statements in those
source files. However, configuration files reference external dependencies in
various ways. Knip uses a plugin for each tool to parse configuration files and
find those dependencies.

In this example we look at [Knip's ESLint plugin][3]. The default `config` file
In this example we look at [Knip's ESLint plugin][5]. The default `config` file
patterns include `.eslintrc.json`. Here's a minimal example:

```json title=".eslintrc.json"
Expand Down Expand Up @@ -164,7 +165,7 @@ jobs:
From these scripts, the `scripts/build.js` and `scripts/deploy.ts` files will be
added as entry files by the GitHub Actions plugin.

You can read more about this in [Script Parser][4].
You can read more about this in [Script Parser][6].

### webpack

Expand Down Expand Up @@ -248,6 +249,8 @@ Plugins are configured with two distinct types of files:
:::

[1]: ../reference/plugins.md
[2]: ./entry-files.md
[3]: ../reference/plugins/eslint.md
[4]: ../features/script-parser.md
[2]: https://github.com/webpro-nl/knip/issues/483
[3]: ../guides/writing-a-plugin.md
[4]: ./entry-files.md
[5]: ../reference/plugins/eslint.md
[6]: ../features/script-parser.md
4 changes: 2 additions & 2 deletions packages/docs/src/content/docs/reference/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ tableOfContents: false
- [Preconstruct][42]
- [Prettier][43]
- [React Cosmos][44]
- [Release It][45]
- [Release It!][45]
- [Remark][46]
- [Remix][47]
- [Rollup][48]
Expand Down Expand Up @@ -128,7 +128,7 @@ tableOfContents: false
[42]: /reference/plugins/preconstruct 'Preconstruct'
[43]: /reference/plugins/prettier 'Prettier'
[44]: /reference/plugins/react-cosmos 'React Cosmos'
[45]: /reference/plugins/release-it 'Release It'
[45]: /reference/plugins/release-it 'Release It!'
[46]: /reference/plugins/remark 'Remark'
[47]: /reference/plugins/remix 'Remix'
[48]: /reference/plugins/rollup 'Rollup'
Expand Down
4 changes: 4 additions & 0 deletions packages/knip/src/plugins/nuxt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import type { NuxtConfig } from './types.js';

const title = 'Nuxt';

const note = `Knip works best with [explicit imports](https://nuxt.com/docs/guide/concepts/auto-imports#explicit-imports).
Nuxt allows to [disable auto-imports](https://nuxt.com/docs/guide/concepts/auto-imports#disabling-auto-imports).`;

const enablers = ['nuxt'];

const isEnabled: IsPluginEnabled = ({ dependencies }) => {
Expand Down Expand Up @@ -52,6 +55,7 @@ const resolveEntryPaths: ResolveEntryPaths<NuxtConfig> = async localConfig => {

export default {
title,
note,
enablers,
isEnabled,
entry,
Expand Down
2 changes: 1 addition & 1 deletion packages/knip/src/plugins/release-it/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { ReleaseItConfig } from './types.js';
// Uses CosmiConfig but with custom searchPlaces
// https://github.com/release-it/release-it/blob/main/lib/config.js

const title = 'Release It';
const title = 'Release It!';

const enablers = ['release-it'];

Expand Down

0 comments on commit 3e0c464

Please sign in to comment.