@dmitryrechkin/eslint-standard 1.5.7 → 1.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,97 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * @file CLI Setup for Aggressive Unused Code Detection
5
- *
6
- * This CLI tool helps set up aggressive unused code detection and cleanup
7
- * in your project with external tools and optimal configurations.
8
- *
9
- * @author PageFast Team
10
- * @version 1.0.0
11
- */
12
-
13
- import { setupAggressiveCleanup } from '../configs/external-tools-setup.mjs';
14
-
15
- // Simple command line argument parsing (avoiding external dependencies)
16
- const args = process.argv.slice(2);
17
- const options = {
18
- global: args.includes('--global') || args.includes('-g'),
19
- packageManager: args.find((arg, i) => (args[i-1] === '--package-manager' || args[i-1] === '-p')) || 'npm',
20
- dryRun: args.includes('--dry-run'),
21
- help: args.includes('--help') || args.includes('-h')
22
- };
23
-
24
- /**
25
- * Main CLI program for setting up aggressive cleanup
26
- */
27
- async function main()
28
- {
29
- try
30
- {
31
- if (options.help)
32
- {
33
- console.log(`
34
- @dmitryrechkin/eslint-standard - Aggressive Cleanup Setup
35
-
36
- Usage:
37
- npx @dmitryrechkin/eslint-standard setup-aggressive-cleanup [options]
38
-
39
- Options:
40
- -g, --global Install cleanup tools globally
41
- -p, --package-manager <type> Package manager to use (npm, pnpm, yarn)
42
- --dry-run Show what would be done without making changes
43
- -h, --help Show this help message
44
-
45
- Examples:
46
- npx @dmitryrechkin/eslint-standard setup-aggressive-cleanup
47
- npx @dmitryrechkin/eslint-standard setup-aggressive-cleanup --global
48
- npx @dmitryrechkin/eslint-standard setup-aggressive-cleanup -p pnpm
49
- npx @dmitryrechkin/eslint-standard setup-aggressive-cleanup --dry-run
50
- `);
51
- return;
52
- }
53
-
54
- if (options.dryRun)
55
- {
56
- console.log('šŸ” DRY RUN - Would perform the following actions:\n');
57
- console.log('1. Install external cleanup tools:');
58
- console.log(' - ts-prune (find unused exports)');
59
- console.log(' - unimported (find unused files)');
60
- console.log(' - knip (advanced dead code elimination)');
61
- console.log(' - depcheck (find unused dependencies)');
62
- console.log(' - ts-remove-unused (remove unused imports)');
63
- console.log('\n2. Add cleanup scripts to package.json');
64
- console.log('\n3. Create optimal tsconfig.json for unused code detection');
65
- console.log('\n4. Create knip.json configuration');
66
- console.log('\nRun without --dry-run to actually perform setup.');
67
- return;
68
- }
69
-
70
- await setupAggressiveCleanup({
71
- packageManager: options.packageManager,
72
- globalTools: options.global
73
- });
74
-
75
- console.log('\nšŸŽ‰ Setup complete! Next steps:');
76
- console.log('\n1. Enable aggressive cleanup in your ESLint config:');
77
- console.log(' ```javascript');
78
- console.log(' import baseConfig from "@dmitryrechkin/eslint-standard";');
79
- console.log(' export default baseConfig({');
80
- console.log(' aggressiveCleanup: true // šŸ”„ Enable aggressive mode');
81
- console.log(' });');
82
- console.log(' ```');
83
- console.log('\n2. Run cleanup check:');
84
- console.log(' npm run cleanup:check');
85
- console.log('\n3. Review and fix issues:');
86
- console.log(' npm run cleanup:fix');
87
-
88
- }
89
- catch (error)
90
- {
91
- console.error('\nāŒ Setup failed:', error.message);
92
- process.exit(1);
93
- }
94
- }
95
-
96
- // Run the main function
97
- main();