• Stars
    star
    109
  • Rank 309,432 (Top 7 %)
  • Language
    JavaScript
  • Created about 6 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

find unused javascript files in your project
you may want to try the library @smeijer/unimported instead of this one.
it's pretty great

unrequired
find unused javascript files

in a big javascript project, sometimes you can forget to delete a unused file.

linters and tree-shakers are good at finding unused code in a module, but they can allow you to have a whole unused file somewhere in your project.

This script follows the require graph, and compares it to the ls output, to find any files that are potentially not being used.

npm install -g unrequired

unrequired ./path/to/my/index.js

or from a node script:

const unrequired = require('unrequired')
let result = unrequired('./tests/mjs/index.js')
console.log(result)
/*
{
  all:[ ... ],  // all javascript files from a 'ls'
  used:[ ... ], // all files in the sourcemap bundle
  unused:[],    // the diff between the two
}
*/

running it may be helpful in a large javascript project! who knows.

It uses rollup โญ๏ธ

Caveats

JSX, and other variants are not currently supported.

It atleast attempts to support esmodules, .mjs files, and some other things.

it won't catch any unrequired .json files.

See Also

MIT

More Repositories

1

compromise

modest natural-language processing
JavaScript
11,140
star
2

spacetime

A lightweight javascript timezone library
JavaScript
3,822
star
3

wtf_wikipedia

a pretty-committed wikipedia markup parser
JavaScript
739
star
4

dumpster-dive

roll a wikipedia dump into mongo
JavaScript
229
star
5

Freebase.js

inference and inspection on freebase data
JavaScript
107
star
6

efrt

neato compression for key-value data
JavaScript
90
star
7

famousd3

get famo.us to render d3js components
JavaScript
27
star
8

somehow-graph

Svelte infographics component
JavaScript
27
star
9

clooney

a graphing library in the famo.us engine
JavaScript
20
star
10

timezone-soft

parse informal timezone names
JavaScript
20
star
11

out-of-character

remove invisible unicode characters
JavaScript
17
star
12

thensome

i guess we'll find out.
JavaScript
15
star
13

spacetime-geo

determine date/time using geo-location
JavaScript
11
star
14

somehow

a number of Svelte infographics
9
star
15

fit-aspect-ratio

like math? me neither!
JavaScript
8
star
16

web-pure-data-front-end

a gui for the pure-data language written for the web
JavaScript
8
star
17

slow

whoa easy there javascript
JavaScript
6
star
18

compromise-highlight

syntax-highlighting for natural language text
JavaScript
6
star
19

wikidata-freebase

helping out in the wikidata migration
JavaScript
6
star
20

spacetime-week

you thought weeks were simple. you weren't right.
JavaScript
5
star
21

sunday-driver

be cool with large files
JavaScript
5
star
22

spacetime-ticks

calculate some sensible break-points between two dates
JavaScript
5
star
23

front_yard

where is the semantic web, if it's not out in front of your own house.
5
star
24

table-turn

html-table parser on the command line
JavaScript
4
star
25

simple_english

simplify natural language english in javascript
JavaScript
4
star
26

somehow-maps

make a map without thinking
JavaScript
4
star
27

compromise-align

generate html aligned by specific text matches
JavaScript
4
star
28

dumpster-dip

parse a wikipedia dump into tiny files
JavaScript
3
star
29

suffix-thumb

find the optimal transformations between words
JavaScript
3
star
30

somehow-calendar

calendar visualization
JavaScript
3
star
31

spacetime-daylight

calculate sunlight exposure for a given timezone
JavaScript
3
star
32

git-slop

cleaner git commands
JavaScript
3
star
33

somehow-circle

an easy way to make radial infographics
JavaScript
3
star
34

townhouse

a new-tab page with browsing history
CoffeeScript
3
star
35

a_wall_map

make a large satelite image to print as a wall map
JavaScript
2
star
36

NLP-OSS-2020

Talk for EMNLP 2020
JavaScript
2
star
37

scratch

first toil, then grave
JavaScript
2
star
38

wtf-plugin-nsfw

WIP content classifier for wikipedia articles
JavaScript
2
star
39

amble

a watch script for cleaner development
JavaScript
2
star
40

wrestlejs

a gui for goofing around with json files
JavaScript
2
star
41

wiki-summary

generate configurable-length descriptions from wikipedia articles
JavaScript
2
star
42

Dirty.js

do questionable things to the js built-in methods
JavaScript
2
star
43

wtf-plugin-mlb

parse baseball game data from wikipedia
JavaScript
2
star
44

crop-aspect

crop an image by a nearby aspect-ratio
JavaScript
2
star
45

nhl_scrape

scrape nhl.com schedule data into json
JavaScript
2
star
46

wtf-plugin-nhl

parse NHL data from wikipedia
JavaScript
2
star
47

Mount-Heavy

an android application to see pictures of nearby people that are no longer living
1
star
48

bitbar

widgets for matryer/bitbar
1
star
49

Spencer-bookmarklets

bookmarklets by spencer
1
star
50

garbage-patch

not the smartest json-patch implementation
JavaScript
1
star
51

Spencer-is-also-ubiquituous

ubiquity commands by spencer
1
star
52

somehow-timeline

a svelte component for layout with time as y-axis
JavaScript
1
star
53

freebase_garden

reasonable workflows for getting wikipedia data into freebase
JavaScript
1
star
54

spencers-chrome-extensions

chrome extensions by spencer
JavaScript
1
star
55

osm_yeah

a workflow for getting openstreetmap data presented into a browser
HTML
1
star
56

spencer-css

some tachyons-inspired css classes
CSS
1
star
57

spencermountain.github.io

yes sir, i do
JavaScript
1
star
58

somehow-ticks

generate nice axis-markings between two arbitrary numbers
JavaScript
1
star
59

somehow-script

a natural-language data-entry format
JavaScript
1
star
60

scal

modern UNIX cal command
JavaScript
1
star
61

somehow-sankey

WIP svelte sankey diagram component
JavaScript
1
star