Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
67a3a55
feat: get all files from path
narcello Jan 3, 2022
d29bee6
feat: show unused files
narcello Jan 3, 2022
97394e0
chore: trying to figure out the logic
narcello Jan 10, 2022
e835ffd
feat: search for folder name
narcello Jan 11, 2022
b74eb8d
feat: start to test single-line comment
narcello Jan 12, 2022
d8b7b66
feat: handle with single line comments
narcello Jan 13, 2022
eedeac4
feat: start to handle multiline comments
narcello Jan 13, 2022
637e230
feat: remove comment lines before regex test
narcello Jan 14, 2022
a86ffa2
chore: install eslint
narcello Jan 17, 2022
7739a03
chore: configure eslint
narcello Jan 17, 2022
c25911c
chore: eslint format
narcello Jan 17, 2022
d92edda
chore: eslint installation
narcello Jan 18, 2022
b498c1c
chore: eslint configuration
narcello Jan 18, 2022
7fe1fc5
chore: add prettier ignore file
narcello Jan 18, 2022
8bf91de
chore: fix findead file based on eslint rules
narcello Jan 18, 2022
36d4339
chore: update readme
narcello Jan 18, 2022
a26001e
chore: install typescript
narcello Jan 19, 2022
6cd1867
chore: typescript config file
narcello Jan 19, 2022
232a0e8
refactor: rename from findead.js to findead.ts
narcello Jan 19, 2022
91a048f
refactor: update lauch json file
narcello Jan 19, 2022
87014a2
docs: update readme
narcello Jan 19, 2022
c169773
chore: install husky
narcello Jan 19, 2022
160a0e7
chore: husky init
narcello Jan 19, 2022
4c55b0a
feat: add husky validations
narcello Jan 19, 2022
def5608
chore: install jest stuff
narcello Jan 20, 2022
d797536
chore: configure jest
narcello Jan 20, 2022
64f1a60
chore: update ignores
narcello Jan 20, 2022
3b99a55
test: first simple test
narcello Jan 20, 2022
bc42325
test: fighting with async tests
narcello Jan 21, 2022
dbdd4b9
chore: update readme
narcello Jan 24, 2022
9315de3
feat: add export conditional to search import file
narcello Jan 24, 2022
92d11f4
test: add all cases and make the first pass
narcello Jan 24, 2022
a10bd3a
feat: flag verification
narcello Jan 25, 2022
8f61954
test: check multiple paths
narcello Jan 25, 2022
bd0fc89
feat: -v and no arguments
narcello Jan 26, 2022
535dca4
test: add tests for version and no arguments
narcello Jan 26, 2022
0539285
feat: add help table
narcello Jan 27, 2022
6f969c0
test: add tests to predicates
narcello Jan 27, 2022
66e23de
docs: update readme
narcello Jan 27, 2022
0a077de
chore: eslint + typescript
narcello Jan 27, 2022
8802433
fix: format on save
narcello Jan 31, 2022
3271320
chore: update readme
narcello Jan 31, 2022
cd514ce
feat: add infos to result
narcello Feb 1, 2022
7138d04
chore: update readme
narcello Feb 1, 2022
7b983de
style: add some colors to findead results
narcello Feb 2, 2022
f76fd59
docs: update readme
narcello Feb 2, 2022
2a268a0
feat: show formatted file size
narcello Feb 3, 2022
24a90b9
refactor: spread log
narcello Feb 3, 2022
30ad0e1
chore: update demo img readme
narcello Feb 3, 2022
891d7c1
feat: add ignored folder
narcello Feb 7, 2022
b724b79
docs: update readme
narcello Feb 7, 2022
f74efac
chore: sorting a house to deploy alfa version
narcello Feb 8, 2022
fc290fb
chore: removed old version things
narcello Feb 10, 2022
5c34f72
chore: solved conflicts
narcello Feb 10, 2022
cf90e71
test: use fake timers legacy
narcello Feb 11, 2022
8d141e3
refactor: new function "isUsedFile"
narcello Feb 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!findead.ts
!findead.test.ts
38 changes: 38 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"eslint-config-airbnb-base"
],
"plugins": [
"@typescript-eslint"
],
"rules": {
"eqeqeq": "error",
"no-console": "off",
"no-undef": "off",
"no-unused-vars": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": "warn"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"env": {
"browser": true,
"node": true,
"es6": true,
"jest": true
},
"ignorePatterns": [
"node_modules",
"build",
"dist",
"public"
]
}
4 changes: 0 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ jobs:

steps:
- uses: actions/checkout@v1
- name: Install Bats
run: ./scripts/install_bats.sh
- name: Install dependencies
run: npm i
- name: Run tests
Expand All @@ -20,8 +18,6 @@ jobs:

steps:
- uses: actions/checkout@v1
- name: Install Bats
run: ./scripts/install_bats.sh
- name: Install dependencies
run: npm i
- name: Run tests
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
dist
coverage
!tests/ignored_paths/dist
!tests/ignored_paths/node_modules
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no -- commitlint --edit "$1"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm test
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
13 changes: 13 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"dbaeumer.vscode-eslint"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [

]
}
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/findead.ts",
"args": ["./src"]
}
]
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
}
6 changes: 6 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
presets: [
['@babel/preset-env', {targets: {node: 'current'}}],
'@babel/preset-typescript',
],
};
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
};
57 changes: 33 additions & 24 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,65 @@
# :mag: findead
Dead react components finder

Dead react components finder

[![NPM Version](https://img.shields.io/npm/v/findead?logo=npm)]()
[![NPM Downloads](https://img.shields.io/npm/dw/findead?logo=npm)]()
![Tests](https://github.com/narcello/findead/workflows/TESTS/badge.svg)

## :dart: Motivation: *Dead Components*
## :dart: Motivation: _Dead Components_

Many times in large or even small projects, we forgot some components in code that we'll never use and we never take time to search one by one and remove.

## :camera: Demonstration
![Demonstration](https://user-images.githubusercontent.com/6786382/73863397-c3d5aa00-481e-11ea-9360-0a530a93cd4a.png)

![Demonstration](https://user-images.githubusercontent.com/6786382/152322590-c2d40b74-f59c-4d05-97f2-08b4dde9481c.png)
When findead finish, you'll can see:
* Components name
* Path of each one component
* Size of each one file
* How many dead components
* How many browsed files
* How much time spent to execution

- Path of each one component
- Size of each one file
- How many dead components
- How many browsed files
- How much time spent to execution

## :computer: Tech
Just bash :)

Made with node and typescript.

## :inbox_tray: Install
* Npm
```sh

- Npm

```sh
npm i -g findead
```
* Yarn
```sh

- Yarn

```sh
yarn add findead
```

## :hammer: Usage

```bash
findead <folder_to_get_components>
```

Pass folder to get all of your components in js, jsx, ts and tsx files.

___obs: By default, all `node_modules` folder is ignored.___
**_obs: By default, all `node_modules` folder is ignored._**

## :zap: Examples
#### Just one argument
* If you pass just one argument, it will be used for `get components` and `search usages`

#### Just one argument


```bash
findead ~/path/to/search
```
#### Raw result
* Pass `-r` flag for raw output. Better for atribute output into a file.
```bash
findead -r ~/path/to/search
```

#### Multiple and specific folders
```bash
findead -m ~/path/to/search/{folder1,folder2,...,folderN}

```bash
findead ~/path/to/search/{folder1,folder2,...,folderN}
```
Loading