Comments (5)
By default, Knip does not report unused exports in entry files.
from knip.
@webpro thank you for responding, but that is not the case. This is not about the entry point file. The pattern occurs within other files that are not the entry point file.
from knip.
The src/test.ts
file can also be an entry file, depending on the enabled plugins. That's why I'd need a reproduction to properly look into it.
You can also use --debug
to get more verbose output, maybe it clears things up.
from knip.
I gave a very simple example. Add any other file as an entrypoint besides this other file as an example that I mentioned above.
You should have as behavior, that the unused function will not be detected.
My case is that I have a very large project, in which Knip is not able to detect many unused functions, and ts-prune can.
I tried to demonstrate a basic example of how to reproduce, because I believe that Knip should be able to replace ts-prune.
from knip.
Sorry, but without a reproduction there's nothing for me to look into. I hope you understand I can't copy-paste everyone's "how to reproduce" dumps.
There's reasons Knip works the way it does by default. There's various ways Knip can be configured to make it behave as you need.
Maybe you're looking for flags like these:
- https://knip.dev/reference/configuration#includeentryexports
- https://knip.dev/reference/configuration#ignoreexportsusedinfile
from knip.
Related Issues (20)
- Get an issue count, when issues > 0 HOT 3
- cannot read the ESLint written in JS. HOT 1
- Knip doesn't parse arguments of `yarn run --top-level` correctly HOT 2
- False Positive for Namespace Import in Vue SFC with Script Setup HOT 3
- Most files are marked as unused when they actually are used HOT 5
- @public modifier does not work if the whole file is unused HOT 9
- New husky format does not work for binaries without 'npx' HOT 2
- Conditional required import not longer working HOT 10
- Running in production mode doesn't allow for easy tagging of internal-only files (as opposed to internal exports) HOT 4
- Packages re-exported under different name through typescript module declaration HOT 1
- vite-plugin-fast-react-svg integration HOT 2
- Knip doesn't resolve imports in Nuxt projects HOT 5
- circular dependencies making knip stuck HOT 6
- detect unused fields returned by setup function HOT 1
- Add support for electron and electron-vite HOT 1
- npm init @knip/config fails on SVN repository HOT 1
- @types/xxx dependencies reported as unused HOT 5
- Cannot run yarn create @knip/config in workspaces root HOT 1
- Add support for Vue composables unused properties detection HOT 1
- Plz know my ‘tsconfig.xyz.json’ HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from knip.