Find and fix dangling files and unused dependencies in your JavaScript projects.

Overview

unimported

Find unused source files in javascript / typescript projects.

screenshot of unimported results

While adding new code to our projects, we might forget to remove the old code. Linters warn us for unused code in a module, but they fail to report unused files.

unimported analyzes your code by following the require/import statements starting from your entry file.

The result is a report showing which files are unimported, which dependencies are missing from your package.json, and which dependencies can be removed from your package.json.

Usage

Run the following command in the root of your project (next to package.json). The result will be as shown under example

npx unimported

When running unimported from a directory that doesn't contain a package.json, it will run from the first parent directory that does. To override this behavior, and run from an alternative work directory, use the [cwd] positional argument:

npx unimported ~/dev/leaflet-geosearch

By providing the path as argument, unimported will start looking for the project root, starting at that location.

Options

Output all options in your terminal:

npx unimported --help

Init

This option will write the default ignore patterns to the .unimportedrc.json settings files. This will enable you to easily adjust them to your needs.

npx unimported --init

Update

Update, will write the current results to the ignore lists in .unimportedrc.json. You want to use this option after running and verifying a full scan. Ignore lists are used to ignore certain false positives that could not be resolved properly. This is especially useful when running unimported on a regular basis, or for example as part of a CI pipeline.

npx unimported --update

Flow Type

By default, flow types are stripped from files containing the @flow pragma. When the --flow argument is provided, types will be stripped from all files, regardless of the pragma. This flag defaults to false, but when flow-bin is detected in one of the dependency lists in package.json.

npx unimported --flow

CI Usage

You can drop in npx unresolved into your CI. It will fail if it finds any unimported files that are not explicitly set up in the unresolved config file.

Cache

Unimported uses a caching system to speed up recurring checks. This cache can be disabled using --no-cache. Note that the cache should only be disabled if you are experiencing caching related problems.

npx unimported --no-cache

If you need to clear the cache, use --clearCache.

Clear Cache

Delete the cache file and then exits without running. Note that clearing the cache will reduce performance.

npx unimported --clear-cache

Show Config

Show the runtime config and then exists without running. The config displayed is a working copy created by merging arguments, your config file, and the applied preset.

npx unimported --show-config

Show Preset

Show the preset being used and then exists without running. Note that presets are dynamic and based on your project structure. The same preset can show a different setup for different projects based on the installed packages and available files.

npx unimported --show-preset react

Omit the preset name to get a list of available presets.

npx unimported --show-preset

Example Config File

Save the file as .unimportedrc.json in the root of your project (next to package.json)

{
  "entry": ["src/main.ts", "src/pages/**/*.{js,ts}"],
  "extensions": [".ts", ".js"],
  "ignorePatterns": ["**/node_modules/**", "private/**"],
  "ignoreUnresolved": ["some-npm-dependency"],
  "ignoreUnimported": ["src/i18n/locales/en.ts", "src/i18n/locales/nl.ts"],
  "ignoreUnused": ["bcrypt", "create-emotion"]
}

Custom module directory You can also add an optional moduleDirectory option to your configuration file to resolve dependencies from other directories than node_modules. This setting defaults to node_modules.

{
  "moduleDirectory": ["node_modules", "src/app"]
}

Custom aliases If you wish to use aliases to import your modules & these can't be imported directly (e.g. tsconfig.json in the case of Typescript or jsconfig.json if you have one), there is an option aliases to provide the correct path mapping:

{
  "aliases": {
    "@components/*": ["./components", "./components/*"]
  }
}

Note: you may wish to also add the rootDir option to specify the base path to start looking for the aliases from:

{
  "rootDir": "./src"
}

Report

The report will look something like below. When a particular check didn't have any positive results, it's section will be excluded from the output.

summary

Summary displays a quick overview of the results, showing the entry points that were used, and some statistics about the outcome.

unresolved imports

These import statements could not be resolved. This can either be a reference to a local file. Or to a node_module. In case of a node module, it can be that nothing is wrong. Maybe you're importing only types from a DefinitelyTyped package. But as unimported only compares against dependencies, it can also be that you've added your module to the devDependencies, and that's a problem.

To ignore specific results, add them to .unimportedrc.json#ignoreUnresolved.

unused dependencies

Some dependencies that are declared in your package.json, were not imported by your code. It should be possible to remove those packages from your project.

But, please double check. Maybe you need to move some dependencies to devDependencies, or maybe it's a peer-dependency from another package. These are hints that something might be wrong. It's no guarantee.

To ignore specific results, add them to .unimportedrc.json#ignoreUnused.

unimported files

The files listed under unimported files, are the files that exist in your code base, but are not part of your final bundle. It should be safe to delete those files.

For your convenience, some files are not shown, as we treat those as 'dev only' files which you might need. More about that below.

To ignore specific results, add them to .unimportedrc.json#ignoreUnimported.

example

       summary
────────────────────────────────────────────────
       entry file 1        : src/client/main.js
       entry file 2        : src/server/main.js

       unresolved imports  : 2
       unused dependencies : 29
       unimported files    : 86


─────┬──────────────────────────────────────────
     │ 2 unresolved imports
─────┼──────────────────────────────────────────
   1 │ geojson
   2 │ csstype
─────┴──────────────────────────────────────────


─────┬──────────────────────────────────────────
     │ 29 unused dependencies
─────┼──────────────────────────────────────────
   1 │ @babel/polyfill
   2 │ @babel/runtime
  .. │ ...
─────┴──────────────────────────────────────────


─────┬──────────────────────────────────────────
     │ 7 unimported files
─────┼──────────────────────────────────────────
   1 │ src/common/components/Button/messages.ts
   2 │ src/common/configs/sentry/graphql.js
  .. │ ...
─────┴──────────────────────────────────────────

How

Unimported follows your import statements starting from one or more entry files. For nextjs projects, the entry files default to pages/**. For Meteor projects, the entry files are read from the package.json#meteor.mainModule key. Meteors eager loading is not supported, as that mode will load all files within your directory, regardless of import statements.

For all other project types, the entry point is looked up in the following order:

  1. ./package.json#source
  2. ./src/index
  3. ./src/main
  4. ./index
  5. ./main
  6. ./package.json#main

The last option is most likely never what you want, as the main field often points to a dist folder. Analyzing a bundled asset is likely to result in false positives.

To specify custom entry points, add them to .unimportedrc.json#entry.

extensions

The resolver scans for files with the following extensions, in this specific order:

  1. .js
  2. .jsx
  3. .ts
  4. .tsx

All other files are ignored.

To specify custom extensions, add your own list to .unimportedrc.json#extensions. Note thatunimported` won't merge settings! The custom list needs to be the full list of extension that you want to support.

ignored

Also ignored are files with paths matching the following patterns:

**/node_modules/**
**/*.tests.{js,jsx,ts,tsx}
**/*.spec.{js,jsx,ts,tsx}

In case unimported is running in a Meteor project, the following paths are being ignored as well:

packages/**
public/**
private/**
tests/**

To specify custom ignore paths, add your own patterns to .unimportedrc.json#ignorePatterns. Note that unimported won't merge settings! The custom list needs to be the full list of patterns that you want to ignore.

Troubleshooting

Common issues or known limitations of unimported.

Export default

At this moment, we don't support the export default from './x' export syntax. Parsing files that contain those exports, will result in an error with a message like '\';\' expected. If you make use of that part of the export default from proposal, you can consider a find/replace before running unimported.

Please search for:

export default from

and replace it with

export { default } from

Unexpected results / stale cache

Please try clearing the cache if you have unexpected results, or keep getting the same results after changing the config file.

npx unimported --clear-cache

See Also

License

MIT License

Contributors

Thanks goes to these wonderful people (emoji key):


Stephan Meijer

🤔 💻 🚇 🚧

Punit Makwana

📖

Dane Wilson

💻

Michael Peyper

⚠️ 💻

Marco Moretti

⚠️

Peter Hozák

⚠️

Jacob M-G Evans

⚠️

Datner

⚠️

Cody Rose

⚠️

Ahmed ElDessouki

⚠️

Yago Pereira Azevedo

⚠️

Juhana Jauhiainen

⚠️

Braydon Hall

⚠️

abeprincec

⚠️

Lucas Westermann

💻 ⚠️

Simon Winter

💻 ⚠️

Martin Šťovíček

📖

Kevin Decker

💻 ⚠️

olidacombe

💻

Punit Makwana

📖

Palanisamy KK

📖

This project follows the all-contributors specification. Contributions of any kind welcome!

Comments
  • Support Vue

    Support Vue

    I’m unfortunately stuck with a framework that encourages using non-standard .vue files. Would be amazing if unimported could parse them.

    Should be rather easy to implement an MVP version IMO, as the most important part would basically be to just ignore everything outside of the <script> block (as that’s not JS/TS) and interpret the result as (j|t)sx?


    yarn run v1.22.10
    $ ./node_modules/.bin/unimported .
    ⠙ resolving imports
    Failed parsing ./source/SomeVueFile.vue
    {
      index: 34,
      lineNumber: 2,
      column: 23,
      message: 'Identifier expected.'
    }
    
    feature 
    opened by FlorianWendelborn 13
  • Don't mark entry files as unimported

    Don't mark entry files as unimported

    Not sure if I just misunderstood something about the configuration, but the way that I understand it, I have to mark tests as entry files, or otherwise test helpers and test dependencies will not be recognized as being imported. But it seems I need to still mark the test files as ignored as well. At the same time, e. g. the pages in my next app are not ignored, but they do not show up in the unimported output. Here's my config for reference:

    {
      "ignorePatterns": [
        "**/node_modules/**"
      ],
      "ignoreUnimported": [],
      "ignoreUnused": [
        "next",
        "react",
        "react-dom"
      ],
      "ignoreUnresolved": [],
      "entry": ["pages/**/*", "src/**/*.stories.tsx", "src/**/*.test.ts", "scripts/*.ts"]
    }
    
    opened by dbartholomae 12
  • Support pure ESM with TypeScript

    Support pure ESM with TypeScript

    I'm migrating a TypeScript project to output pure ESM. As part of that effort, I need to update every import which was previously extensionless, to specify a ".js" extension (even though the file in the source directory has a ".ts" extension). Like this:

    // old way
    import aThing from '../a/module';
    
    // new way
    import aThing from '../a/module.js';
    

    It seems like unimported is unable to determine that ../a/module.js should be resolved to ../a/module.ts and so it reports almost all files as being unimported.

    I've been referencing this guide for the migration to pure ESM.

    released 
    opened by chasingmaxwell 12
  • Issues with platform-specific React Native files

    Issues with platform-specific React Native files

    Hey!

    I was running this on my React Native project, and I noticed that it wasn't able to follow an import such as ./User and resolve it to ./User.ios.tsx and ./User.android.tsx.

    I realise this is an edge-case and might be difficult to solve since IIRC these special extensions are handled by Metro. Just wanted to surface this in case anyone else has the same issue. Luckily I have very few platform-specific files so this tool is still super valuable.

    Thanks!

    feature 
    opened by salockhart 12
  • Unable to find unimported files

    Unable to find unimported files

    First off, I apologize if this is not the preferred channel of communication for these "issues".

    I've got Unimported running through my codebases at this point, properly finding unused dependencies. However I am unable to get it to find my unused files. I've even created new files to see if they will be detected but no luck. All of our files are just .js extensions. Before adding the aliases to my config, I did have unresolved imports, since those issues are fixed I believed it would be able to find my files.

    Here is what my current config looks like:

    .unimportedrc.json

    {
    	"entry": ["apps/manager/src/index.js"],
    	"extensions": [".js"],
    	"ignorePatterns": ["**/node_modules/**"],
    	"ignoreUnresolved": ["some-npm-dependency"],
    	"ignoreUnimported": ["src/i18n/locales/en.ts", "src/i18n/locales/nl.ts"],
    	"ignoreUnused": ["create-emotion", "unimported"],
    	"aliases": {
    		"~/*": ["apps/manager/src/*"],
    		"Lib/*": ["lib/node/src/*"],
    		"ROOT":  ["./../../*"]
    	}
    }
    

    My Output

    Screen Shot 2021-07-14 at 2 52 38 PM

    If there's a more appropriate area or contact for these general questions, please let me know.

    Thanks in advance, Danny

    question 
    opened by dabyland 10
  • `ignoreUnimported` does not work with relative paths as of 1.20.0

    `ignoreUnimported` does not work with relative paths as of 1.20.0

    When using unimported version 1.20.0, it seems only absolute file paths are supported for the ignoreUnimported setting. I noticed this when, after updating, I was suddenly getting unimported errors for files that were previously being ignored. Running npx unimported -u only adds absolute paths to the config file, and changing them to relative paths causes them to stop working.

    This is not only a breaking change with previous versions of .unimportedrs.json, but also causes issues when sharing config across team members.

    Tested on Windows 10 with a Meteor project using Meteor version 2.7.1. I'm not sure if this replicates across other types of projects, or if it's a meteor-specific issue.

    bug help wanted os-windows 
    opened by plof27 9
  • feat: add regex path transformation

    feat: add regex path transformation

    This is useful for TypeScript projects outputing pure ESM.

    See https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-make-my-typescript-project-output-esm.

    Closes #66.

    released 
    opened by chasingmaxwell 9
  • Add support for jsconfig and baseUrl

    Add support for jsconfig and baseUrl

    First, this is a really helpful tool, thank you for making it.

    I have a file structure that looks something like:

    src/
    -- presentation/
    ---- client.js
    ---- api.js
    

    api is imported by client.js using an absolute import from the src directory: import * as api from '/presentation/api.js'

    However, this is not picked up by unimported, I get the following output:

    Unresolved import:
    presentation/api.js
    
    Unimported files:
    src/presentation/api.js
    

    In my jsconfig, I set the root to src, like so:

    {
      "compilerOptions": {
        "baseUrl": "src"
      },
      "include": ["src"]
    }
    

    to enable the absolute imports.

    Do you know how to make this work?

    feature 
    opened by theahura 8
  • fix: Stop fresh builds from failing

    fix: Stop fresh builds from failing

    I had to fix the build before I could even get started having a look at implementing a PR for #61.

    This is based in part off the work done in #69, although I've taken a different approach to handling the errors. In Typescript you can solve the issue with Errors being unknown with instanceof narrowing. This has the benefit of matching what we're already doing in index.ts, and being typesafe to boot.

    I did have to make use of some dodgy casting in the print.ts tests, as far as I can tell console-testing-library has a fix, but the latest released package doesn't have the change.

    I've also just gone ahead and made a package-lock.json for this project, while I know locks were purged in #17, the fact that locks were removed meant that unimported suffered bitrot due to packages updating and making breaking changes in their minor versions (I'm looking at you typescript).

    It might be worth also looking at updating the github workflow (the cy.yml) to use npm ci instead of npm i when downloading dependencies since it should be faster & encourage the use of the lockfile, but I'm not going to make changes there unless requested.

    opened by jarjee 7
  • TSconfig support with CRACO

    TSconfig support with CRACO

    Hi there,

    Firstly - this is a fantastic project, love your work!

    We have a create-react-app, using Typescript with craco to override some configuration limitations of CRA.

    Part of this setup is to use craco-alias - which recommends using a separate tsconfig file (as some options are prevented from being overwritten by CRA), so you get this kind of setup:

    tsconfig.json:

    {
      "extends": "./tsconfig.extend.json",
      "compilerOptions": {
        "target": "es5",
        ...
    }
    

    tsconfig.extend.json:

      "compilerOptions": {
        "baseUrl": "./src",
        "paths": {
          "~api/*": ["./api/*", "./api"],
          "~assets/*": ["./assets/*", "./assets"],
          "~components/*": ["./components/*", "./components"],
          ...
        }
      }
    }
    

    Is there anyway to either get unimported to recognise the extends option in tsconfig.json so that it can find the aliases contained therein, or to supply additional files to unimported to load?

    opened by simonwinter 7
  • add support for webpack alias

    add support for webpack alias

    Cannot detect the imported file if a project not use relative path import.

    For example, use babel-plugin-module-resolver:

    // .babelrc
    {
      "plugins": [
        [ "module-resolver", {
           "alias": {
              "@": "./src"
            }
         }]
      ]
    }
    

    or use webpack resolve. alias

    module.exports = {
      //...
      resolve: {
        alias: {
          '@': path.resolve(__dirname, 'src')
        }
      }
    };
    
    opened by xyy94813 7
  • chore(deps): bump json5 from 2.2.0 to 2.2.2

    chore(deps): bump json5 from 2.2.0 to 2.2.2

    Bumps json5 from 2.2.0 to 2.2.2.

    Release notes

    Sourced from json5's releases.

    v2.2.2

    • Fix: Properties with the name __proto__ are added to objects and arrays. (#199) This also fixes a prototype pollution vulnerability reported by Jonathan Gregson! (#295).

    v2.2.1

    • Fix: Removed dependence on minimist to patch CVE-2021-44906. (#266)
    Changelog

    Sourced from json5's changelog.

    v2.2.2 [code, diff]

    • Fix: Properties with the name __proto__ are added to objects and arrays. (#199) This also fixes a prototype pollution vulnerability reported by Jonathan Gregson! (#295).

    v2.2.1 [code, diff]

    • Fix: Removed dependence on minimist to patch CVE-2021-44906. (#266)
    Commits
    • 14f8cb1 2.2.2
    • 10cc7ca docs: update CHANGELOG for v2.2.2
    • 7774c10 fix: add proto to objects and arrays
    • edde30a Readme: slight tweak to intro
    • 97286f8 Improve example in readme
    • d720b4f Improve readme (e.g. explain JSON5 better!) (#291)
    • 910ce25 docs: fix spelling of Aseem
    • 2aab4dd test: require tap as t in cli tests
    • 6d42686 test: remove mocha syntax from tests
    • 4798b9d docs: update installation and usage for modules
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Allow package.json#source to be an array or a string

    Allow package.json#source to be an array or a string

    Allows the package.json#source field to be populated with an array of multiple files (maintains backwards compatibility as a string).

    Additionally, updates ts-node due to a bug with 9.1.1; the unit tests fail on main right now.

    opened by nweber-gh 0
  • chore(deps): bump simple-git from 3.7.1 to 3.15.0

    chore(deps): bump simple-git from 3.7.1 to 3.15.0

    Bumps simple-git from 3.7.1 to 3.15.0.

    Release notes

    Sourced from simple-git's releases.

    [email protected]

    Minor Changes

    • 7746480: Disables the use of inline configuration arguments to prevent unitentionally allowing non-standard remote protocols without explicitly opting in to this practice with the new allowUnsafeProtocolOverride property having been enabled.

    Patch Changes

    • 7746480: - Upgrade repo dependencies - lerna and jest
      • Include node@19 in the test matrix

    [email protected]

    Patch Changes

    • 5a2e7e4: Add version parsing support for non-numeric patches (including "built from source" style 1.11.GIT)

    [email protected]

    Minor Changes

    • 19029fc: Create the abort plugin to allow cancelling all pending and future tasks.
    • 4259b26: Add .version to return git version information, including whether the git binary is installed.

    [email protected]

    Minor Changes

    • 87b0d75: Increase the level of deprecation notices for use of simple-git/promise, which will be fully removed in the next major
    • d0dceda: Allow supplying just one of to/from in the options supplied to git.log

    Patch Changes

    • 6b3e05c: Use shared test utilities bundle in simple-git tests, to enable consistent testing across packages in the future

    [email protected]

    Minor Changes

    • bfd652b: Add a new configuration option to enable trimming white-space from the response to git.raw

    [email protected]

    Minor Changes

    • 80d54bd: Added fields updated + deleted branch info to fetch response, closes #823

    Patch Changes

    • 75dfcb4: Add prettier configuration and apply formatting throughout.

    [email protected]

    Minor Changes

    • 2f021e7: Support for importing as an ES module with TypeScript moduleResolution node16 or newer by adding simpleGit as a named export.

    ... (truncated)

    Changelog

    Sourced from simple-git's changelog.

    3.15.0

    Minor Changes

    • 7746480: Disables the use of inline configuration arguments to prevent unitentionally allowing non-standard remote protocols without explicitly opting in to this practice with the new allowUnsafeProtocolOverride property having been enabled.

    Patch Changes

    • 7746480: - Upgrade repo dependencies - lerna and jest
      • Include node@19 in the test matrix

    3.14.1

    Patch Changes

    • 5a2e7e4: Add version parsing support for non-numeric patches (including "built from source" style 1.11.GIT)

    3.14.0

    Minor Changes

    • 19029fc: Create the abort plugin to allow cancelling all pending and future tasks.
    • 4259b26: Add .version to return git version information, including whether the git binary is installed.

    3.13.0

    Minor Changes

    • 87b0d75: Increase the level of deprecation notices for use of simple-git/promise, which will be fully removed in the next major
    • d0dceda: Allow supplying just one of to/from in the options supplied to git.log

    Patch Changes

    • 6b3e05c: Use shared test utilities bundle in simple-git tests, to enable consistent testing across packages in the future

    3.12.0

    Minor Changes

    • bfd652b: Add a new configuration option to enable trimming white-space from the response to git.raw

    3.11.0

    Minor Changes

    • 80d54bd: Added fields updated + deleted branch info to fetch response, closes #823

    Patch Changes

    • 75dfcb4: Add prettier configuration and apply formatting throughout.

    ... (truncated)

    Commits
    • d4764bf Version Packages
    • 7746480 Chore: bump lerna, jest and create prettier workflow (#862)
    • 6b3c631 Create the unsafe plugin to configure how simple-git treats known potenti...
    • e459622 Version Packages
    • 5a2e7e4 Add version parsing support for non-numeric patches (to include built… (#853)
    • 6460a1f Version Packages
    • 4259b26 Create interface for retrieving git version information (#850)
    • 19029fc Abort plugin (#848)
    • ee801ae Version Packages
    • d0dceda Allow using just one of from and to in the git.log options. (#846)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Allow YAML or JS format for configuration file

    Allow YAML or JS format for configuration file

    My application is using the @uniswap/widgets package which for some reason does not install the necessary packages by himself and I add to install some dependencies manually.

    This is my current configuration:

    {
      "entry": [
        "src/pages/**/*.page.{ts,tsx}",
        "src/worker/index.ts",
        "next.config.js",
        "cypress/e2e/*.cy.ts",
        "cypress/support/e2e.ts"
      ],
      "ignorePatterns": ["**/node_modules/**", "public/**"],
      "ignoreUnimported": ["src/icons/IconTemplate.js"],
    
      "__note": "@ethersproject/abi jotai-immer are required by @uniswap/widgets",
      "ignoreUnused": ["next", "react", "react-dom", "@ethersproject/abi", "jotai-immer"],
      "ignoreUnresolved": ["tslib", "cross-fetch", "extract-files", "form-data"]
    }
    

    As you can see, there is a pseudo-comment explaining why I am ignoring @ethersproject/abi and jotai-immer packages.

    I would like to be able to write the configuration file as a YAML file which will allow comments:

    entry:
    - src/pages/**/*.page.{ts,tsx}
    - src/worker/index.ts
    - next.config.js
    - cypress/e2e/*.cy.ts
    - cypress/support/e2e.ts
    ignorePatterns:
    - "**/node_modules/**"
    - public/**
    ignoreUnimported:
    - src/icons/IconTemplate.js
    
    ignoreUnused:
    - next
    - react
    - react-dom
    # Required by @uniswap/widgets
    - "@ethersproject/abi"
    - jotai-immer
    
    ignoreUnresolved:
    - tslib
    - cross-fetch
    - extract-files
    - form-data
    

    Happy to open a PR if interested.

    opened by mathieu-bour 1
  • unresolved imports contains file imports with resourceQuery (e.g. 'filename.ext?query')

    unresolved imports contains file imports with resourceQuery (e.g. 'filename.ext?query')

    Consider the following import:

    import ImgAsComponent from 'img/thing.svg?component';

    As no alias or pattern ignore or wildcards apply for unresolved imports, these imports will be reported, and no configuration can help this

    feature 
    opened by dzsodzso63 1
  • Support for `.mdx`

    Support for `.mdx`

    Is it possible to get unimported to somehow parse .mdx files? We have a couple in a project I'm working on and without the unimported report isn't very precise

    opened by voxpelli 1
Releases(v1.24.0)
  • v1.24.0(Dec 16, 2022)

  • v1.23.0(Nov 15, 2022)

  • v1.22.0(Sep 14, 2022)

  • v1.21.0(Jun 21, 2022)

  • v1.20.3(Jun 20, 2022)

  • v1.20.1(May 30, 2022)

    What's Changed

    • ci: run tests on Windows as well 9696eb3b44abf4637e6228961c4af7d5528965e0
    • fix: add support for Windows d7959735344907bd654f6ceac12afd38362d6ba4
    • chore: Add related packages by @karlhorky in https://github.com/smeijer/unimported/pull/93
    • docs: fix typo by @dbartholomae in https://github.com/smeijer/unimported/pull/92
    • docs: change --clearCache to --clear-cache by @Slapbox in https://github.com/smeijer/unimported/pull/95

    New Contributors

    • @karlhorky made their first contribution in https://github.com/smeijer/unimported/pull/93
    • @Slapbox made their first contribution in https://github.com/smeijer/unimported/pull/95

    Full Changelog: https://github.com/smeijer/unimported/compare/v1.20.0...v1.20.1

    Source code(tar.gz)
    Source code(zip)
  • v1.20.0(May 2, 2022)

    Features:

    • feat: use checksum for cacheing ebba1dc

    Fixes:

    • fix: stop fresh builds from failing (#81) b81ce0b
    • fix: local builds with updated dependencies. (#69) aeab1a6
    • fix: use moduleDirectory from config file 6157a63
    • chore: improve path printing (#68) 76d9caf

    Other:

    • docs: explain CI usage in README (#75) c5564c0
    • chore: remove type casts d75f4a9
    • chore: commit package-lock.json (#87) 50ce58d
    • ci: run ci also on push to main 21ac25e
    • ci: bump node version to v14.x (#86) 33df185

    Deps:

    • deps: bump minimist from 1.2.5 to 1.2.6 (#89) 424972d
    • deps: bump simple-git to 3.7.1 52062f3
    • deps: pin console-testing-library to 0.6.0 02458fa
    • deps: pin flow-remove-types to 2.156.0 966ce2e

    https://github.com/smeijer/unimported/compare/v1.19.0...v1.20.0

    Source code(tar.gz)
    Source code(zip)
  • v1.19.0(Aug 9, 2021)

    • chore: expand troubleshooting section in readme 5d25f35
    • test: fix test 83e29fd
    • fix: only retry traversal in case of cache errors 944d1ae
    • feat: support flowtype type and typeof imports b849105
    • chore: move comment 17b96a5

    https://github.com/smeijer/unimported/compare/v1.18.0...v1.19.0

    Source code(tar.gz)
    Source code(zip)
  • v1.18.0(Aug 8, 2021)

    • feat: support react-native .native.js target e8f1e76
    • feat: support more script variants for vue 68cccfe
    • chore: update readme df4954b
    • feat: add --show-preset flag 6714b9e
    • chore: improve presets d79b877
    • fix: merge all extensions together on config root 25e5c89
    • feat: add --show-config flag 1f2b8ad
    • feat: use presets to improve project type detection and handling 11cb187
    • fix: merge all extensions together on config root 75b05d6
    • feat: support comments in json files fa7aa13
    • feat: add support for entry file level overrides 3ebfc3c

    https://github.com/smeijer/unimported/compare/v1.17.0...v1.18.0

    Source code(tar.gz)
    Source code(zip)
  • v1.17.0(Aug 5, 2021)

  • v1.16.0(Aug 5, 2021)

  • v1.15.0(Aug 5, 2021)

    • feat: support running from nested directories 447e080
    • chore: update readme f70d72e

    https://github.com/smeijer/unimported/compare/v1.14.0...v1.15.0

    Source code(tar.gz)
    Source code(zip)
  • v1.14.0(Aug 5, 2021)

    • feat: add support for aliased file imports cdc8d0e
    • feat: support index imports from aliased directories 08e95ff
    • feat: add --clear-cache option to purge existing cache a2e43a6
    • feat: add --no-cache option to run without caching mechanism b9ce79c
    • perf: filter out non-unique aliases 3be0c32

    https://github.com/smeijer/unimported/compare/v1.13.0...v1.14.0

    Source code(tar.gz)
    Source code(zip)
Owner
Stephan Meijer
Dad, Husband, Developer. Full stack engineer, product owner, founder of various B2B collaboration platforms, maintainer of open source.
Stephan Meijer
Purple hats Desktop is a customisable, automated web accessibility testing tool that allows software development teams to find and fix accessibility problems to improve persons with disabilities (PWDs) access to digital services.

Purple HATS Desktop Purple hats Desktop is a desktop frontend for Purple HATS accessibility site scanner - a customisable, automated web accessibility

Government Digital Services, Singapore 6 May 11, 2023
Save resources by suspending unused tabs after 20 min.

Tab Suspender [WIP] Save resources by suspending unused tabs after 20 min. Instalation Enable Epiphany extension. Optional if not done. Download the l

null 5 May 7, 2022
A file manager plugin for logseq(Search unused assets file)

logseq-plugin-file-manager Search files from assets and draws but not used in journals or pages. Please backup files before operation, and before dele

Hayden Chen 17 Dec 23, 2022
Fix your mistake when you forget to change your keyboard language!

Persian Typo Mistake ???? Introduction With this extension, you can fix your text that is written in Persian but on an English keyboard. this extensio

Hadi Zare 27 Nov 23, 2022
Find stale dependencies in the package.json file(s).

staledeps Find stale dependencies in the package.json file(s). Installation npm install -g staledeps Or simply using npx, the package runner bundled

Michael Mok 6 Dec 15, 2022
Use PageRank to find the most important files in your codebase.

Deprank Deprank uses the PageRank algorithm to find the most important files in your JavaScript or TypeScript codebase. It uses dependency-cruiser to

codemix 680 Dec 30, 2022
Find duplicate object values of your JSON files (VSCode Extension)

JASON Lint VS Code Extension Make your life easier, use this extension to defeat the horror of duplicate values from your JSON files. Very useful when

Leonardo Pizzoquero 3 Oct 20, 2022
FIXYL is a tool for testing and verifying software that uses the FIX protocol.

FIXYL FIXYL is a tool for testing and verifying software that uses the FIX protocol. It allows establishing FIX sessions and exchanging (and manipulat

Yaala Labs 22 Dec 29, 2022
Auto-Fix Hundreds of Grammarly Errors With This Script

This script automatically applies your Grammarly suggestions. Use case: Large document with 100+ errors How to use: Go to Grammarly Web app Go to Edit

null 48 Jan 3, 2023
Debug express.js server code with Ray to fix problems faster

express-ray Install this package in any Express.js project to provide an exceptional debugging experience using the Ray app by Spatie. Installation In

Permafrost Software 8 Nov 3, 2022
fix out-of-memory actions at colors@^1.4.1

What's it for? colors@^1.4.1 has action of out-of-memory: https://github.com/Marak/colors.js/commit/5d2d242f656103ac38086d6b26433a09f1c38c75. https://

hoperyy 6 Jan 11, 2022
Fix for Object.hasOwnProperty, which normally just returns a boolean, which is not good when you care about strong typing.

Welcome to ts-has-own-property ?? Fix for Object.hasOwnProperty, which normally just returns a boolean, which is not good when you care about strong t

Funtal Foundation 1 Jul 4, 2022
Fix for Object.keys, which normally just returns an array of strings, which is not good when you care about strong typing

Welcome to ts-object-keys ?? Fix for Object.keys, which normally just returns an array of strings, which is not good when you care about strong typing

Funtal Foundation 1 Jul 4, 2022
A GitHub Action for creating Changesets files for dependencies updates.

changesets-dependencies-action A GitHub Action for creating Changesets files for dependencies updates. This action will automatically monitor all your

The Guild 19 Sep 28, 2022
JavaScript library for parsing Dirtywave M8 files, complete with a CLI for interacting with M8 files.

m8-js This repository contains a JavaScript library for parsing Dirtywave M8 files, as well as a CLI for interacting with M8 files. The hopes are not

Jeremy Whitlock 20 Dec 17, 2022
🎨 Beautify your github profile with this amazing tool, creating the readme your way in a simple and fast way 🚀 The best profile readme generator you will find ⚡

Demo Profile Readme Generator The best profile readme generator you will find! About | Technologies | Requirements | Starting | Contributing ?? About

Mauro de Souza 476 Jan 1, 2023
Add Your Skill & Find Your Developer Friend

Add Your Skill & Find Your Developer Friend! Want to contribute to this project? ?? Tech Stack html css nextjs tailwind Contributing Pull requests are

Ankita Malik 17 Nov 17, 2022
Download all Moodle files with one click. This is a Chrome extension built to save time and effort from downloading files manually one by one!

Moodle Downloader Extension Moodle downloader extension for Chrome. The extension is tested with both the TUM moodle and the official moodle demo. Not

Zhongpin Wang 8 Nov 15, 2022
Vaultacks lets users store files off-chain on Gaia. Files are encrypted by default but also can be made public and shared

Vaultacks Vaultacks is built on the Stacks Chain. It lets users upload files to Gaia, a off-chain data storage system. Vaultacks currently uses the de

Anish De 5 Sep 14, 2022