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

Request new plugins here #483

Closed
webpro opened this issue Jan 29, 2024 · 58 comments
Closed

Request new plugins here #483

webpro opened this issue Jan 29, 2024 · 58 comments
Labels
plugin An issue or enhancement in a plugin

Comments

@webpro
Copy link
Collaborator

webpro commented Jan 29, 2024

Please add one comment per plugin (please link to website/repo/docs), which others can then upvote using reactions like 👍 (not more comments).

The idea is that you can request/upvote plugins here. Contributors/me can implement them.

Please make sure the plugin isn't already available/listed on https://knip.dev/reference/plugins

@webpro webpro added the plugin An issue or enhancement in a plugin label Jan 29, 2024
@webpro webpro pinned this issue Jan 29, 2024
@webpro
Copy link
Collaborator Author

webpro commented Jan 29, 2024

Ladle (#268)

@webpro
Copy link
Collaborator Author

webpro commented Jan 29, 2024

Vike (#275)

@birtles
Copy link
Contributor

birtles commented Jan 30, 2024

React cosmos

Includes:

/cc @ovidiuch

@Faithfinder
Copy link
Contributor

NestJS, maybe?

It's very class based, so it would be focused on classMembers rules.

It would need to detect usage of class members by decorators, basically - e.g, something decorated with @ResolveField is used.

@webpro
Copy link
Collaborator Author

webpro commented Feb 4, 2024

WebdriverIO (#464)

@justingrant
Copy link

Not sure if this is a plugin or core, but support for .mdx files. (used by Storybook and other docs generators)

@webpro
Copy link
Collaborator Author

webpro commented Feb 5, 2024

@justingrant Please file a separate issue for this (as it's not a plugin).

@netner-d
Copy link

netner-d commented Feb 9, 2024

Serverless framework (1 183 585 downloads a week). It uses serverless.yml files for config and includes :

  • Plugins (docs/eg)
  • Serverless function definitions, so entries (docs/eg, under functions.*.handler field)

@webpro
Copy link
Collaborator Author

webpro commented Feb 9, 2024

Please don't dump words here. It'll be a lot more convincing if you'd be more precise and provide one or two links to the library and/or configuration pages to avoid any ambiguity.

@netner-d
Copy link

netner-d commented Feb 9, 2024

Please don't dump words here. It'll be a lot more convincing if you'd be more precise and provide one or two links to the library and/or configuration pages to avoid any ambiguity.

Yeah, absolutely sorry about that, I thought it was the method to collect people opinion as I saw similar comments above... I'm rectifying

@webpro
Copy link
Collaborator Author

webpro commented Mar 24, 2024

tsd (#535)

@DaniFoldi
Copy link
Contributor

wrangler
ideas: find wrangler.toml/json and set main as entrypoint, and exclude from unused dependencies

@webpro
Copy link
Collaborator Author

webpro commented Mar 24, 2024

Just saying, for anyone interested, it's now more fun and easier than ever to write a plugin: https://knip.dev/guides/writing-a-plugin

@guy-borderless
Copy link

is deno compat a plugin? If so, what would it take? Deno uses the web standard import_map.json

@sifferhans
Copy link

Would it be possible to create a Nuxt plugin? Nuxt heavily uses auto-imports, so I imagine it could be harder to trace down what is being used.

@auvred
Copy link
Contributor

auvred commented Apr 23, 2024

Docusaurus - https://docusaurus.io/

@webpro
Copy link
Collaborator Author

webpro commented Apr 29, 2024

Ionic (#604)

@bbeesley
Copy link
Contributor

bbeesley commented May 3, 2024

I was gonna request xo, but I've just opened a PR for it instead since I was interested in how they work.
#621

@webpro
Copy link
Collaborator Author

webpro commented May 7, 2024

Plugins added recently:

@emmanuelchucks
Copy link

Expo (expo.dev)

@tmm
Copy link
Contributor

tmm commented Jun 5, 2024

size-limit (and related packages @size-limit/*)

@webpro
Copy link
Collaborator Author

webpro commented Jun 6, 2024

For everyone interested in support for Expo, please see #126. Looking for feedback!

@jerone
Copy link
Contributor

jerone commented Jun 11, 2024

lockfile linting

lint lockfiles for improved security and trust policies

https://github.com/lirantal/lockfile-lint
https://github.com/lirantal/lockfile-lint/blob/main/packages/lockfile-lint/README.md

@birtles
Copy link
Contributor

birtles commented Jul 19, 2024

Can be tested with npm i -D https://pkg.pr.new/knip@2de3924 (or any package manager). Would be very useful if you could try it out to increase coverage and improve the plugins.

Works great for me. Thank you!

@silverwind
Copy link

silverwind commented Jul 26, 2024

Makefile:

lint:
	npx eslint

Should mark eslint as used. I would say this should be core functionality, e.g not a plugin.

@BMFreed
Copy link

BMFreed commented Aug 6, 2024

@webpro I know this was already requested, but are there plans to add a Nuxt plugin?

@webpro
Copy link
Collaborator Author

webpro commented Aug 6, 2024

Re. Nuxt plugin: Usually "auto-imports" might be hard to track indeed during static or even dynamic analysis.

In general not doing much of new features myself at the moment. Sponsored might be an option (DM me). Open to pull requests!

@BMFreed
Copy link

BMFreed commented Aug 6, 2024

Re. Nuxt plugin: Usually "auto-imports" might be hard to track indeed during static or even dynamic analysis.

In general not doing much of new features myself at the moment. Sponsored might be an option (DM me). Open to pull requests!

Thank you for your reply!

@with-heart
Copy link

preconstruct allows multiple entrypoints to be defined in a package's package.json file. Standalone entrypoints currently have to be manually defined using entry.

@webpro
Copy link
Collaborator Author

webpro commented Aug 23, 2024

VitePress (Site Config)

@webpro
Copy link
Collaborator Author

webpro commented Aug 23, 2024

Karma (Configuration File)

@webpro
Copy link
Collaborator Author

webpro commented Aug 31, 2024

Added a few plugins in v5.28.0:

NOTE: the Nuxt plugin has no support for auto-import magic, except for defineNuxtConfig (to prevent insta-throw/offs). Should probably add a warning on the plugin page.

@flip-it
Copy link

flip-it commented Sep 24, 2024

package.json:

{
  …
  "dependencies": {
    …
    "@company/browserslist-config": "2.0.0",
  },
  "browserslist": [
    "extends @company/browserslist-config"
  ],
  …
}

should not throw Unused dependencies for @company/browserslist-config

@Faithfinder
Copy link
Contributor

Panda CSS (I think just the config file?)
PostCSS, should be included with Vite plugin

@RafalFilipek
Copy link

tsx.

Currently

// ./bin/index.ts

#!/usr/bin/env tsx

const x: string = 'Hello knip';

is not detected.

// ./package.json

{
  "bin": {
    "app": "./bin/index.ts"
  },

  "dependencies": {
    "tsx": "4.7.1",
  },

}

@webpro
Copy link
Collaborator Author

webpro commented Oct 23, 2024

Does #!/usr/bin/env tsx point to the tsx dependency executable (in the project's node_modules)? Please file a separate bug report if you think Knip should handle this better as this is rather core area (not so much plugin-specific).

@FrankiePo
Copy link

FrankiePo commented Oct 28, 2024

Vinxi

@FrankiePo
Copy link

Nitro

@roduyemi
Copy link

roduyemi commented Oct 31, 2024

Flow

Getting some false positives for type exports. unimported used to have an option to remove flow types and I wonder if that's needed or I need to add any additional configuration to detect unused flow types?

Thanks!

@bigpopakap
Copy link

bigpopakap commented Nov 14, 2024

Prisma ORM

Maybe this specific issue isn't in scope for a Prisma plugin, but my prisma/seed.ts file is getting flagged but is used in a package.json script:

"prisma": {
    "seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
  },

@mattfysh
Copy link

Pulumi

You might scan for **/Pulumi.yaml and create a new entry per pulumi stack program.

@webpro
Copy link
Collaborator Author

webpro commented Nov 16, 2024

Friendly reminder to everyone that it's cool to implement plugins and submit pull requests ❤️

@lensbart
Copy link

lensbart commented Dec 3, 2024

React Router v7 — getting false positives after upgrading from Remix

@webpro
Copy link
Collaborator Author

webpro commented Dec 3, 2024

Went through the list, this seems the be the status:

✅ DONE

  • capacitor/ionic
  • ladle
  • lockfile-lint
  • nest
  • nuxt
  • postcss
  • preconstruct
  • react-cosmos
  • rsbuild
  • rspack
  • size-limit
  • tsx
  • vike
  • webdriver-io
  • wrangler
  • xo

❌ NOT DONE/STATUS UNKNOWN

  • Deno
  • Docusaurus
  • Expo
  • Karma
  • Nitro
  • PandaCSS
  • Prisma
  • Pulumi
  • React Router v7
  • serverless
  • tsd
  • Vinxi
  • VitePress

Note that existing plugins may be imperfect and incomplete.

Going to close this issue, since it appears we're not getting much out of it. Regular issues and PRs are fine actually. Feel free to open pull requests to add new plugins!

Thanks for your input and contributions! ❤️

@webpro webpro closed this as completed Dec 3, 2024
@webpro webpro unpinned this issue Dec 3, 2024
@lasseklovstad
Copy link
Contributor

lasseklovstad commented Dec 8, 2024

React Router v7 — getting false positives after upgrading from Remix

I created temperary solution for react router 7 before a plugin is created:

import type { RouteConfigEntry } from "@react-router/dev/routes";
import { KnipConfig } from "knip";
import path from "path";
import { fileURLToPath } from "url";

const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
const __dirname = path.dirname(__filename); // get the name of the directory
const appDir = __dirname + "/app";
globalThis.__reactRouterAppDirectory = appDir;
const routes = await import("./app/routes");

const routeConfig = await routes.default;

const mapRoute = (route: RouteConfigEntry): string[] => {
   return [`app/${route.file}`, ...(route.children ? route.children.flatMap(mapRoute) : [])];
};
const routeEntryFiles = routeConfig.flatMap(mapRoute);
export default {
   entry: [
      ...routeEntryFiles,
      "public/sw.js",
      "server.mjs",
      "app/root.tsx",
      "app/entry.client.tsx",
      "app/entry.server.tsx",
      "react-router.config.ts",
   ],
} satisfies KnipConfig;

@s7dhansh
Copy link

MeteorJS.
It imports files as absolute import by default. eg. /src/main instead of src/main. Hence the result from knip is completely inaccurate. May be there is a config option to do that, but as of now I have not been able to find it.

Thanks.

@superfaz
Copy link

superfaz commented Jan 6, 2025

SASS/SCSS.
It can import dependencies via @use or @import.

Thanks.

@webpro
Copy link
Collaborator Author

webpro commented Jan 6, 2025

This ticket is closed, I'll remove the remaining links to this ticket from the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin An issue or enhancement in a plugin
Projects
None yet
Development

No branches or pull requests