-
Notifications
You must be signed in to change notification settings - Fork 3
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
Detect unused exports #82
Comments
Just tried quickly running ➜ ts-unused-exports-example git:(main) npx ts-unused-exports tsconfig.json
11 modules with unused exports
/Users/k/p/ts-unused-exports-example/pages/index.tsx: default
/Users/k/p/ts-unused-exports-example/pages/thankyou.tsx: default
/Users/k/p/ts-unused-exports-example/utils/types.tsx: Data
/Users/k/p/ts-unused-exports-example/pages/_app.js: default
/Users/k/p/ts-unused-exports-example/pages/cart.js: default, getServerSideProps
/Users/k/p/ts-unused-exports-example/pages/testcheck.js: default, getServerSideProps
/Users/k/p/ts-unused-exports-example/pages/api/hello.js: default
/Users/k/p/ts-unused-exports-example/pages/products/[product].js: default, getServerSideProps
/Users/k/p/ts-unused-exports-example/pages/products/item/[item].js: default, getServerSideProps
/Users/k/p/ts-unused-exports-example/utils/cookies.js: deleteAll
/Users/k/p/ts-unused-exports-example/utils/database.js: getProducts, getProductById, getProductsByType One thing that we need to do is to filter out all of the errors on default exports within the pages folder (because Next.js consumes these exports) |
Seems like
But it doesn't seem to have as many options, some of which we may need. |
|
To detect and error on variables and functions that have been exported but not imported somewhere (this is "dead code")
Source: https://blog.logrocket.com/how-to-use-static-code-analysis-to-write-quality-javascript-typescript/#:~:text=for%20our%20typescript%20project%2C%20i%20use%20ts-unused-exports%2C%20but%20for%20plain%20javascript%2C%20you%20can%20use%20a%20similar%20no-unused-export%20package
Full list of options:
knip
ts-unused-exports
no-unused-export
ts-prune
unimported
eslint-plugin-import/no-unused-modules
(withunusedExports
option)@typescript-eslint/eslint-plugin
cc @Josehower
The text was updated successfully, but these errors were encountered: