This repository has been archived by the owner on Mar 10, 2024. It is now read-only.
Tags: smeijer/unimported
Tags
Add support for alternative config files with cosmiconfig (#178) Fixes #118 Introduces `cosmiconfig` as requested in #118 in order to support loading the config from alternative file formats like: ``` .unimportedrc.js .unimportedrc.yml package.json > "unimported" key ``` I'm using `cosmiconfigSync` utilities instead of the async version, despite them being available since the `getConfig` is an async method. When we use the async equivalent, we hit a segfault in Node as a result of `cosmiconfig` trying to call a dynamic import on the file within a Jest context that doesn't allow it to. Patched in a recent version of Node, and once the test infra can require the latest version it should be fine to switch to the async version. See nodejs/node#35889 and jestjs/jest#11438 I haven't made any efforts to change the `update` function to write updates to the loaded files, as this would be difficult/impossible to update something like a .js or .yml (if using features like anchors) in a meaningful way. A few notes on the other changes included: 1. `cosmiconfig` pulls in a newer version of TypeScript which was incompatible with the version of `@types/node` we used, updated it 2. One of the tests produced invalid JSON to a config file, which failed silently before and passed the test, but now fails loudly when `cosmiconfig` tries to read and parse the JSON. Updated it to be valid to fulfill the spirit of the test. --------- Co-authored-by: Stephan Meijer <[email protected]>
feat: support unimported assets (#148) closes #91 closes #57 Add `assetsExtensions` on config for tracing assets files like jpeg, png, etc. Files with extensions in `assetsExtensions` are not ignored when detecting unimported files and marked as resolved if imported. --------- Co-authored-by: Stephan Meijer <[email protected]>
feat: added format flags for unused, unimported and unresolved to pri… …nt them separately (#139) * feat: added format flags for unused, unimported and unresolved to print them separately * feat: removed unwanted console --------- Co-authored-by: Aditya Vandan Sharma <[email protected]>
PreviousNext