{"id":51590584,"url":"https://github.com/bentimor/salts","last_synced_at":"2026-07-11T14:03:10.093Z","repository":{"id":328716399,"uuid":"1115195479","full_name":"BenTimor/Salts","owner":"BenTimor","description":"Detect unused functions and methods in TypeScript projects","archived":false,"fork":false,"pushed_at":"2025-12-12T14:39:55.000Z","size":63,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-17T11:12:00.539Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BenTimor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-12T13:35:17.000Z","updated_at":"2025-12-16T19:55:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/BenTimor/Salts","commit_stats":null,"previous_names":["bentimor/salts"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/BenTimor/Salts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenTimor%2FSalts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenTimor%2FSalts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenTimor%2FSalts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenTimor%2FSalts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BenTimor","download_url":"https://codeload.github.com/BenTimor/Salts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenTimor%2FSalts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35364269,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-11T02:00:05.354Z","response_time":104,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-07-11T14:03:09.371Z","updated_at":"2026-07-11T14:03:10.084Z","avatar_url":"https://github.com/BenTimor.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Salts\n\nA TypeScript dead code detector that finds unused functions and methods using Babel AST analysis.\n\n![Example Screenshot](assets/example-screenshot.png \"Example Screenshot\")\n\n## Features\n\n- Detects unused functions, methods, and arrow functions\n- Handles alias resolution (variable assignments, imports, exports)\n- Supports JSX callback detection\n- Optional React function component detection (`--jsx-components`)\n- Tracks transitive usage through assignment chains\n- Configurable export handling\n\n## Installation\n\n```bash\nnpm install salts\n```\n\n### From Source\n\n```bash\nnpm install\nnpm run build\n```\n\n## Usage\n\n```bash\n# Analyze a directory\nnpx salts ./src\n\n# Include exported functions in the report\nnpx salts ./src --include-exports\n\n# Count React component usage as function usage\nnpx salts ./src --jsx-components\n\n# Ignore additional patterns\nnpx salts ./src --ignore \"**/*.test.ts\" --ignore \"**/fixtures/**\"\n```\n\n### Options\n\n| Option | Description |\n|--------|-------------|\n| `--include-exports` | Include exported functions in dead code report (by default, exports are considered \"used\") |\n| `--jsx-components` | Count JSX component usage (e.g., `\u003cMyComponent /\u003e`) as function usage |\n| `--ignore \u003cpatterns\u003e` | Additional glob patterns to exclude from analysis |\n\n## How It Works\n\n### What's Detected as a Function Declaration\n\n- Named functions: `function foo() {}`\n- Class methods: `class X { method() {} }`\n- Arrow functions: `const foo = () =\u003e {}`\n- Function expressions: `const foo = function() {}`\n\n### What Counts as Usage\n\nA function is considered \"used\" if it is:\n\n1. Called directly: `myFunc()`\n2. Called as a method: `obj.myFunc()`, `this.myFunc()`, `obj['myFunc']()`\n3. Passed as a callback: `arr.map(myFunc)`\n4. Used in JSX: `\u003cButton onClick={myFunc} /\u003e`\n5. Assigned and the assignment is used: `const x = myFunc; x()`\n6. Imported with alias: `import { func as alias }` where `alias` is used\n7. Exported with alias: `export { func as alias }` where `alias` is used\n8. Used as a JSX component: `\u003cMyComponent /\u003e` (requires `--jsx-components` flag)\n\n### Alias Resolution\n\nAssignment chains are followed transitively:\n\n```typescript\nconst x = myFunc;\nconst y = x;\ny(); // myFunc is marked as used\n```\n\n## Default Ignored Patterns\n\n- `**/node_modules/**`\n- `**/dist/**`\n- `**/build/**`\n- `**/*.d.ts`\n- `**/.git/**`\n\n## Development\n\n```bash\n# Build the project\nnpm run build\n\n# Watch mode\nnpm run dev\n\n# Run tests\nnpm test\n\n# Run tests with coverage\nnpm run test:coverage\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbentimor%2Fsalts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbentimor%2Fsalts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbentimor%2Fsalts/lists"}