code-quality-lib 1.1.0 → 2.0.0
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.
- package/README.md +15 -6
- package/index.js +22 -7
- package/package.json +19 -1
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
- 📄 Detailed error reports for developers and AI agents
|
|
22
22
|
- 🔍 --logs flag for verbose terminal output
|
|
23
23
|
- 🤖 AI-friendly structured error information
|
|
24
|
+
- 📦 **All dependencies bundled** - No need to install TypeScript, ESLint, Prettier, Knip, or Snyk separately!
|
|
24
25
|
|
|
25
26
|
## Installation
|
|
26
27
|
|
|
@@ -145,12 +146,20 @@ checker.run().then(result => {
|
|
|
145
146
|
|
|
146
147
|
### Default Tools
|
|
147
148
|
|
|
148
|
-
The library runs these tools by default:
|
|
149
|
-
- **TypeScript** - Type checking and compilation
|
|
150
|
-
- **ESLint** - Code linting and style checking
|
|
151
|
-
-
|
|
152
|
-
-
|
|
153
|
-
-
|
|
149
|
+
The library runs these tools by default (all bundled, no separate installation needed):
|
|
150
|
+
- **TypeScript** (v5.8.3) - Type checking and compilation
|
|
151
|
+
- **ESLint** (v9.18.0) - Code linting and style checking with plugins:
|
|
152
|
+
- @typescript-eslint/eslint-plugin & parser
|
|
153
|
+
- eslint-plugin-react & react-hooks
|
|
154
|
+
- eslint-plugin-prettier
|
|
155
|
+
- eslint-plugin-sonarjs
|
|
156
|
+
- eslint-plugin-unicorn
|
|
157
|
+
- eslint-plugin-import
|
|
158
|
+
- **Prettier** (v3.4.2) - Code formatting validation
|
|
159
|
+
- **Knip** (v5.43.2) - Dead code detection and unused exports
|
|
160
|
+
- **Snyk** (v1.1293.1) - Security vulnerability scanning
|
|
161
|
+
|
|
162
|
+
**No need to install these tools separately!** Everything is bundled with the library.
|
|
154
163
|
|
|
155
164
|
### Custom Configuration
|
|
156
165
|
|
package/index.js
CHANGED
|
@@ -48,16 +48,31 @@ const reportPath = path.join(process.cwd(), '.quality-report.md');
|
|
|
48
48
|
const timestamp = new Date().toISOString();
|
|
49
49
|
let reportContent = `# Code Quality Report\n\n`;
|
|
50
50
|
reportContent += `**Generated**: ${timestamp}\n`;
|
|
51
|
-
reportContent += `**Package Manager**:
|
|
51
|
+
reportContent += `**Package Manager**: npm\n\n`;
|
|
52
52
|
reportContent += `---\n\n`;
|
|
53
53
|
|
|
54
|
-
//
|
|
54
|
+
// Get paths to bundled tools - try to resolve from library location
|
|
55
|
+
let libPath;
|
|
56
|
+
try {
|
|
57
|
+
libPath = path.dirname(require.resolve('code-quality-lib/package.json'));
|
|
58
|
+
} catch {
|
|
59
|
+
// Fallback to current directory if running from library itself
|
|
60
|
+
libPath = __dirname;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const tscPath = path.join(libPath, 'node_modules', '.bin', 'tsc');
|
|
64
|
+
const eslintPath = path.join(libPath, 'node_modules', '.bin', 'eslint');
|
|
65
|
+
const prettierPath = path.join(libPath, 'node_modules', '.bin', 'prettier');
|
|
66
|
+
const knipPath = path.join(libPath, 'node_modules', '.bin', 'knip');
|
|
67
|
+
const snykPath = path.join(libPath, 'node_modules', '.bin', 'snyk');
|
|
68
|
+
|
|
69
|
+
// Run quality checks using bundled dependencies
|
|
55
70
|
const checks = [
|
|
56
|
-
{ name: 'TypeScript', cmd:
|
|
57
|
-
{ name: 'ESLint', cmd:
|
|
58
|
-
{ name: 'Prettier', cmd:
|
|
59
|
-
{ name: 'Knip', cmd:
|
|
60
|
-
{ name: 'Snyk', cmd:
|
|
71
|
+
{ name: 'TypeScript', cmd: `${tscPath} --noEmit`, description: 'Type checking and compilation' },
|
|
72
|
+
{ name: 'ESLint', cmd: `${eslintPath} . --ext .js,.jsx,.ts,.tsx`, description: 'Code linting and style checking' },
|
|
73
|
+
{ name: 'Prettier', cmd: `${prettierPath} --check .`, description: 'Code formatting validation' },
|
|
74
|
+
{ name: 'Knip', cmd: `${knipPath}`, description: 'Dead code detection' },
|
|
75
|
+
{ name: 'Snyk', cmd: `${snykPath} test --severity-threshold=high`, description: 'Security vulnerability scanning' }
|
|
61
76
|
];
|
|
62
77
|
|
|
63
78
|
let allPassed = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "code-quality-lib",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A configurable code quality checker library for Node.js projects",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -30,6 +30,24 @@
|
|
|
30
30
|
"engines": {
|
|
31
31
|
"node": ">=18.0.0"
|
|
32
32
|
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"typescript": "^5.8.3",
|
|
35
|
+
"eslint": "^9.18.0",
|
|
36
|
+
"prettier": "^3.4.2",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^8.20.0",
|
|
38
|
+
"@typescript-eslint/parser": "^8.20.0",
|
|
39
|
+
"eslint-config-prettier": "^9.1.0",
|
|
40
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
41
|
+
"eslint-plugin-react": "^7.37.2",
|
|
42
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
43
|
+
"eslint-plugin-react-refresh": "^0.4.16",
|
|
44
|
+
"eslint-plugin-storybook": "^0.11.1",
|
|
45
|
+
"eslint-plugin-sonarjs": "^2.0.4",
|
|
46
|
+
"eslint-plugin-unicorn": "^57.0.0",
|
|
47
|
+
"eslint-plugin-import": "^2.31.0",
|
|
48
|
+
"knip": "^5.43.2",
|
|
49
|
+
"snyk": "^1.1293.1"
|
|
50
|
+
},
|
|
33
51
|
"files": [
|
|
34
52
|
"index.js",
|
|
35
53
|
"index.d.ts",
|