@sun-asterisk/sunlint 1.0.5
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/CHANGELOG.md +202 -0
- package/LICENSE +21 -0
- package/README.md +490 -0
- package/cli-legacy.js +355 -0
- package/cli.js +35 -0
- package/config/default.json +22 -0
- package/config/presets/beginner.json +36 -0
- package/config/presets/ci.json +46 -0
- package/config/presets/recommended.json +24 -0
- package/config/presets/strict.json +32 -0
- package/config/rules-registry.json +681 -0
- package/config/sunlint-schema.json +166 -0
- package/config/typescript/custom-rules-new.js +0 -0
- package/config/typescript/custom-rules.js +9 -0
- package/config/typescript/eslint.config.js +110 -0
- package/config/typescript/package-lock.json +1585 -0
- package/config/typescript/package.json +13 -0
- package/config/typescript/security-rules/index.js +90 -0
- package/config/typescript/security-rules/s005-no-origin-auth.js +95 -0
- package/config/typescript/security-rules/s006-activation-recovery-secret-not-plaintext.js +69 -0
- package/config/typescript/security-rules/s008-crypto-agility.js +62 -0
- package/config/typescript/security-rules/s009-no-insecure-crypto.js +103 -0
- package/config/typescript/security-rules/s010-no-insecure-random-in-sensitive-context.js +123 -0
- package/config/typescript/security-rules/s011-no-insecure-uuid.js +66 -0
- package/config/typescript/security-rules/s012-hardcode-secret.js +71 -0
- package/config/typescript/security-rules/s014-insecure-tls-version.js +50 -0
- package/config/typescript/security-rules/s015-insecure-tls-certificate.js +43 -0
- package/config/typescript/security-rules/s016-sensitive-query-parameter.js +59 -0
- package/config/typescript/security-rules/s017-no-sql-injection.js +193 -0
- package/config/typescript/security-rules/s018-positive-input-validation.js +56 -0
- package/config/typescript/security-rules/s019-no-raw-user-input-in-email.js +113 -0
- package/config/typescript/security-rules/s020-no-eval-dynamic-execution.js +89 -0
- package/config/typescript/security-rules/s022-output-encoding.js +78 -0
- package/config/typescript/security-rules/s023-no-json-injection.js +300 -0
- package/config/typescript/security-rules/s025-server-side-input-validation.js +217 -0
- package/config/typescript/security-rules/s026-json-schema-validation.js +68 -0
- package/config/typescript/security-rules/s027-no-hardcoded-secrets.js +80 -0
- package/config/typescript/security-rules/s029-require-csrf-protection.js +79 -0
- package/config/typescript/security-rules/s030-no-directory-browsing.js +78 -0
- package/config/typescript/security-rules/s033-require-samesite-cookie.js +80 -0
- package/config/typescript/security-rules/s034-require-host-cookie-prefix.js +77 -0
- package/config/typescript/security-rules/s035-cookie-specific-path.js +74 -0
- package/config/typescript/security-rules/s036-no-unsafe-file-include.js +68 -0
- package/config/typescript/security-rules/s037-require-anti-cache-headers.js +70 -0
- package/config/typescript/security-rules/s038-no-version-disclosure.js +74 -0
- package/config/typescript/security-rules/s039-no-session-token-in-url.js +63 -0
- package/config/typescript/security-rules/s041-require-session-invalidate-on-logout.js +211 -0
- package/config/typescript/security-rules/s042-require-periodic-reauthentication.js +294 -0
- package/config/typescript/security-rules/s043-terminate-sessions-on-password-change.js +254 -0
- package/config/typescript/security-rules/s044-require-full-session-for-sensitive-operations.js +292 -0
- package/config/typescript/security-rules/s045-anti-automation-controls.js +46 -0
- package/config/typescript/security-rules/s046-secure-notification-on-auth-change.js +44 -0
- package/config/typescript/security-rules/s048-password-credential-recovery.js +54 -0
- package/config/typescript/security-rules/s050-session-token-weak-hash.js +94 -0
- package/config/typescript/security-rules/s052-secure-random-authentication-code.js +66 -0
- package/config/typescript/security-rules/s054-verification-default-account.js +109 -0
- package/config/typescript/security-rules/s057-utc-logging.js +54 -0
- package/config/typescript/security-rules/s058-no-ssrf.js +73 -0
- package/config/typescript/test-s005-working.ts +22 -0
- package/config/typescript/tsconfig.json +29 -0
- package/core/ai-analyzer.js +169 -0
- package/core/analysis-orchestrator.js +705 -0
- package/core/cli-action-handler.js +230 -0
- package/core/cli-program.js +106 -0
- package/core/config-manager.js +396 -0
- package/core/config-merger.js +136 -0
- package/core/config-override-processor.js +74 -0
- package/core/config-preset-resolver.js +65 -0
- package/core/config-source-loader.js +152 -0
- package/core/config-validator.js +126 -0
- package/core/dependency-manager.js +105 -0
- package/core/eslint-engine-service.js +312 -0
- package/core/eslint-instance-manager.js +104 -0
- package/core/eslint-integration-service.js +363 -0
- package/core/git-utils.js +170 -0
- package/core/multi-rule-runner.js +239 -0
- package/core/output-service.js +250 -0
- package/core/report-generator.js +320 -0
- package/core/rule-mapping-service.js +309 -0
- package/core/rule-selection-service.js +121 -0
- package/core/sunlint-engine-service.js +23 -0
- package/core/typescript-analyzer.js +262 -0
- package/core/typescript-engine.js +313 -0
- package/docs/AI.md +163 -0
- package/docs/ARCHITECTURE.md +78 -0
- package/docs/CI-CD-GUIDE.md +315 -0
- package/docs/COMMAND-EXAMPLES.md +256 -0
- package/docs/DEBUG.md +86 -0
- package/docs/DISTRIBUTION.md +153 -0
- package/docs/ESLINT-INTEGRATION-STRATEGY.md +392 -0
- package/docs/ESLINT_INTEGRATION.md +238 -0
- package/docs/FOLDER_STRUCTURE.md +59 -0
- package/docs/HEURISTIC_VS_AI.md +113 -0
- package/docs/README.md +32 -0
- package/docs/RELEASE_GUIDE.md +230 -0
- package/docs/RULE-RESPONSIBILITY-MATRIX.md +204 -0
- package/eslint-integration/.eslintrc.js +98 -0
- package/eslint-integration/cli.js +35 -0
- package/eslint-integration/eslint-plugin-custom/c002-no-duplicate-code.js +204 -0
- package/eslint-integration/eslint-plugin-custom/c003-no-vague-abbreviations.js +246 -0
- package/eslint-integration/eslint-plugin-custom/c006-function-name-verb-noun.js +207 -0
- package/eslint-integration/eslint-plugin-custom/c010-limit-block-nesting.js +90 -0
- package/eslint-integration/eslint-plugin-custom/c013-no-dead-code.js +43 -0
- package/eslint-integration/eslint-plugin-custom/c014-abstract-dependency-preferred.js +38 -0
- package/eslint-integration/eslint-plugin-custom/c017-limit-constructor-logic.js +39 -0
- package/eslint-integration/eslint-plugin-custom/c018-no-generic-throw.js +335 -0
- package/eslint-integration/eslint-plugin-custom/c023-no-duplicate-variable-name-in-scope.js +142 -0
- package/eslint-integration/eslint-plugin-custom/c027-limit-function-nesting.js +50 -0
- package/eslint-integration/eslint-plugin-custom/c029-catch-block-logging.js +80 -0
- package/eslint-integration/eslint-plugin-custom/c030-use-custom-error-classes.js +294 -0
- package/eslint-integration/eslint-plugin-custom/c034-no-implicit-return.js +34 -0
- package/eslint-integration/eslint-plugin-custom/c035-no-empty-catch.js +32 -0
- package/eslint-integration/eslint-plugin-custom/c041-no-config-inline.js +64 -0
- package/eslint-integration/eslint-plugin-custom/c042-boolean-name-prefix.js +406 -0
- package/eslint-integration/eslint-plugin-custom/c043-no-console-or-print.js +300 -0
- package/eslint-integration/eslint-plugin-custom/c047-no-duplicate-retry-logic.js +239 -0
- package/eslint-integration/eslint-plugin-custom/c048-no-var-declaration.js +31 -0
- package/eslint-integration/eslint-plugin-custom/c076-one-assert-per-test.js +184 -0
- package/eslint-integration/eslint-plugin-custom/index.js +155 -0
- package/eslint-integration/eslint-plugin-custom/package.json +13 -0
- package/eslint-integration/eslint-plugin-custom/package.json.bak +9 -0
- package/eslint-integration/eslint-plugin-custom/s003-no-unvalidated-redirect.js +86 -0
- package/eslint-integration/eslint-plugin-custom/s005-no-origin-auth.js +95 -0
- package/eslint-integration/eslint-plugin-custom/s006-activation-recovery-secret-not-plaintext.js +69 -0
- package/eslint-integration/eslint-plugin-custom/s008-crypto-agility.js +62 -0
- package/eslint-integration/eslint-plugin-custom/s009-no-insecure-crypto.js +103 -0
- package/eslint-integration/eslint-plugin-custom/s010-no-insecure-random-in-sensitive-context.js +123 -0
- package/eslint-integration/eslint-plugin-custom/s011-no-insecure-uuid.js +66 -0
- package/eslint-integration/eslint-plugin-custom/s012-hardcode-secret.js +71 -0
- package/eslint-integration/eslint-plugin-custom/s014-insecure-tls-version.js +50 -0
- package/eslint-integration/eslint-plugin-custom/s015-insecure-tls-certificate.js +43 -0
- package/eslint-integration/eslint-plugin-custom/s016-sensitive-query-parameter.js +59 -0
- package/eslint-integration/eslint-plugin-custom/s017-no-sql-injection.js +193 -0
- package/eslint-integration/eslint-plugin-custom/s018-positive-input-validation.js +56 -0
- package/eslint-integration/eslint-plugin-custom/s019-no-raw-user-input-in-email.js +113 -0
- package/eslint-integration/eslint-plugin-custom/s020-no-eval-dynamic-execution.js +89 -0
- package/eslint-integration/eslint-plugin-custom/s022-output-encoding.js +78 -0
- package/eslint-integration/eslint-plugin-custom/s023-no-json-injection.js +300 -0
- package/eslint-integration/eslint-plugin-custom/s025-server-side-input-validation.js +217 -0
- package/eslint-integration/eslint-plugin-custom/s026-json-schema-validation.js +68 -0
- package/eslint-integration/eslint-plugin-custom/s027-no-hardcoded-secrets.js +80 -0
- package/eslint-integration/eslint-plugin-custom/s029-require-csrf-protection.js +79 -0
- package/eslint-integration/eslint-plugin-custom/s030-no-directory-browsing.js +78 -0
- package/eslint-integration/eslint-plugin-custom/s033-require-samesite-cookie.js +80 -0
- package/eslint-integration/eslint-plugin-custom/s034-require-host-cookie-prefix.js +77 -0
- package/eslint-integration/eslint-plugin-custom/s035-cookie-specific-path.js +74 -0
- package/eslint-integration/eslint-plugin-custom/s036-no-unsafe-file-include.js +68 -0
- package/eslint-integration/eslint-plugin-custom/s037-require-anti-cache-headers.js +70 -0
- package/eslint-integration/eslint-plugin-custom/s038-no-version-disclosure.js +74 -0
- package/eslint-integration/eslint-plugin-custom/s039-no-session-token-in-url.js +63 -0
- package/eslint-integration/eslint-plugin-custom/s041-require-session-invalidate-on-logout.js +211 -0
- package/eslint-integration/eslint-plugin-custom/s042-require-periodic-reauthentication.js +294 -0
- package/eslint-integration/eslint-plugin-custom/s043-terminate-sessions-on-password-change.js +254 -0
- package/eslint-integration/eslint-plugin-custom/s044-require-full-session-for-sensitive-operations.js +292 -0
- package/eslint-integration/eslint-plugin-custom/s045-anti-automation-controls.js +46 -0
- package/eslint-integration/eslint-plugin-custom/s046-secure-notification-on-auth-change.js +44 -0
- package/eslint-integration/eslint-plugin-custom/s047-secure-random-passwords.js +108 -0
- package/eslint-integration/eslint-plugin-custom/s048-password-credential-recovery.js +54 -0
- package/eslint-integration/eslint-plugin-custom/s050-session-token-weak-hash.js +94 -0
- package/eslint-integration/eslint-plugin-custom/s052-secure-random-authentication-code.js +66 -0
- package/eslint-integration/eslint-plugin-custom/s054-verification-default-account.js +109 -0
- package/eslint-integration/eslint-plugin-custom/s055-verification-rest-check-the-incoming-content-type.js +143 -0
- package/eslint-integration/eslint-plugin-custom/s057-utc-logging.js +54 -0
- package/eslint-integration/eslint-plugin-custom/s058-no-ssrf.js +73 -0
- package/eslint-integration/eslint-plugin-custom/t002-interface-prefix-i.js +42 -0
- package/eslint-integration/eslint-plugin-custom/t003-ts-ignore-reason.js +48 -0
- package/eslint-integration/eslint-plugin-custom/t004-interface-public-only.js +160 -0
- package/eslint-integration/eslint-plugin-custom/t007-no-fn-in-constructor.js +52 -0
- package/eslint-integration/eslint-plugin-custom/t011-no-real-time-dependency.js +175 -0
- package/eslint-integration/eslint-plugin-custom/t019-no-empty-type.js +95 -0
- package/eslint-integration/eslint-plugin-custom/t025-no-nested-union-tuple.js +48 -0
- package/eslint-integration/eslint-plugin-custom/t026-limit-nested-generics.js +377 -0
- package/eslint-integration/eslint.config.js +125 -0
- package/eslint-integration/eslint.config.simple.js +24 -0
- package/eslint-integration/node_modules/eslint-plugin-custom/package.json +0 -0
- package/eslint-integration/package.json +23 -0
- package/eslint-integration/sample.ts +53 -0
- package/eslint-integration/test-s003.js +5 -0
- package/eslint-integration/tsconfig.json +27 -0
- package/examples/.github/workflows/code-quality.yml +111 -0
- package/examples/.sunlint.json +42 -0
- package/examples/README.md +47 -0
- package/examples/package.json +33 -0
- package/package.json +100 -0
- package/rules/C006_function_naming/analyzer.js +338 -0
- package/rules/C006_function_naming/config.json +86 -0
- package/rules/C019_log_level_usage/analyzer.js +359 -0
- package/rules/C019_log_level_usage/config.json +121 -0
- package/rules/C029_catch_block_logging/analyzer.js +339 -0
- package/rules/C029_catch_block_logging/config.json +59 -0
- package/rules/C031_validation_separation/README.md +72 -0
- package/rules/C031_validation_separation/analyzer.js +186 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
# 🚀 SunLint CI/CD Integration Guide
|
|
2
|
+
|
|
3
|
+
## 📋 **Tổng quan các chức năng CLI**
|
|
4
|
+
|
|
5
|
+
### ✅ **Phạm vi kiểm tra**
|
|
6
|
+
- ✅ Kiểm tra 1 file: `node cli.js --all --input=file.js`
|
|
7
|
+
- ✅ Kiểm tra 1 folder: `node cli.js --all --input=src`
|
|
8
|
+
- ✅ Kiểm tra toàn project: `node cli.js --all --input=.`
|
|
9
|
+
- ✅ Kiểm tra changed files: `node cli.js --all --changed-files`
|
|
10
|
+
- ✅ Kiểm tra staged files: `node cli.js --all --staged-files`
|
|
11
|
+
|
|
12
|
+
### ✅ **Lựa chọn rules**
|
|
13
|
+
- ✅ 1 rule: `node cli.js --rule=C019 --input=src`
|
|
14
|
+
- ✅ Nhiều rules: `node cli.js --rules=C019,C006 --input=src`
|
|
15
|
+
- ✅ Tất cả rules: `node cli.js --all --input=src`
|
|
16
|
+
- ✅ Theo category: `node cli.js --quality --input=src`
|
|
17
|
+
|
|
18
|
+
### ✅ **Phương pháp phân tích**
|
|
19
|
+
- ✅ Pattern-based (free): `node cli.js --all --input=src --no-ai`
|
|
20
|
+
- ✅ AI-powered (cost): `node cli.js --all --input=src --ai`
|
|
21
|
+
|
|
22
|
+
### ✅ **CI/CD Features**
|
|
23
|
+
- ✅ Git integration: `--changed-files`, `--staged-files`, `--diff-base`
|
|
24
|
+
- ✅ Baseline comparison: `--baseline`, `--save-baseline`
|
|
25
|
+
- ✅ New violations only: `--fail-on-new-violations`
|
|
26
|
+
- ✅ Multiple output formats: `--format=json|eslint|github|summary`
|
|
27
|
+
|
|
28
|
+
## 🎯 **CI/CD Strategies**
|
|
29
|
+
|
|
30
|
+
### **Strategy 1: Full Coverage (Traditional)**
|
|
31
|
+
```bash
|
|
32
|
+
# Advantages: Complete analysis, no missed issues
|
|
33
|
+
# Disadvantages: Slow, expensive, noisy for large projects
|
|
34
|
+
|
|
35
|
+
# Usage:
|
|
36
|
+
node cli.js --all --input=. --format=json --output=report.json
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### **Strategy 2: Incremental (Recommended)**
|
|
40
|
+
```bash
|
|
41
|
+
# PR Check: Only changed files
|
|
42
|
+
node cli.js --all --changed-files --diff-base=origin/main --fail-on-new-violations
|
|
43
|
+
|
|
44
|
+
# Main Branch: Full scan + baseline
|
|
45
|
+
node cli.js --all --input=. --save-baseline=baseline.json --format=json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### **Strategy 3: Risk-Based**
|
|
49
|
+
```bash
|
|
50
|
+
# High-risk areas only
|
|
51
|
+
node cli.js --security --input=src/auth,src/payment --format=summary
|
|
52
|
+
|
|
53
|
+
# Critical rules only
|
|
54
|
+
node cli.js --rules=C019,S001,S003 --changed-files --format=github
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 📊 **Performance Comparison**
|
|
58
|
+
|
|
59
|
+
| Scope | Files | Time | Use Case |
|
|
60
|
+
|-------|-------|------|----------|
|
|
61
|
+
| Single file | 1 | ~1-3s | IDE integration, pre-commit |
|
|
62
|
+
| Changed files (PR) | 5-20 | ~10-30s | PR checks, fast feedback |
|
|
63
|
+
| Module/folder | 50-200 | ~1-2min | Feature development |
|
|
64
|
+
| Full project | 500+ | ~3-10min | Nightly builds, releases |
|
|
65
|
+
|
|
66
|
+
## 🔄 **Workflow Examples**
|
|
67
|
+
|
|
68
|
+
### **GitHub Actions - Complete Setup**
|
|
69
|
+
|
|
70
|
+
```yaml
|
|
71
|
+
name: SunLint Quality Gates
|
|
72
|
+
on:
|
|
73
|
+
push:
|
|
74
|
+
branches: [main]
|
|
75
|
+
pull_request:
|
|
76
|
+
branches: [main]
|
|
77
|
+
|
|
78
|
+
env:
|
|
79
|
+
NODE_VERSION: '18'
|
|
80
|
+
|
|
81
|
+
jobs:
|
|
82
|
+
# Job 1: PR Quality Check (fast)
|
|
83
|
+
pr-check:
|
|
84
|
+
if: github.event_name == 'pull_request'
|
|
85
|
+
runs-on: ubuntu-latest
|
|
86
|
+
steps:
|
|
87
|
+
- uses: actions/checkout@v3
|
|
88
|
+
with:
|
|
89
|
+
fetch-depth: 0
|
|
90
|
+
|
|
91
|
+
- name: Setup Node.js
|
|
92
|
+
uses: actions/setup-node@v3
|
|
93
|
+
with:
|
|
94
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
95
|
+
|
|
96
|
+
- name: Install SunLint
|
|
97
|
+
run: |
|
|
98
|
+
cd coding-quality/extensions/sunlint
|
|
99
|
+
npm install
|
|
100
|
+
|
|
101
|
+
- name: Download Baseline
|
|
102
|
+
uses: actions/download-artifact@v3
|
|
103
|
+
with:
|
|
104
|
+
name: sunlint-baseline
|
|
105
|
+
path: coding-quality/extensions/sunlint/
|
|
106
|
+
continue-on-error: true
|
|
107
|
+
|
|
108
|
+
- name: Run SunLint on Changed Files
|
|
109
|
+
run: |
|
|
110
|
+
cd coding-quality/extensions/sunlint
|
|
111
|
+
node cli.js --all --changed-files \
|
|
112
|
+
--diff-base=origin/${{ github.base_ref }} \
|
|
113
|
+
--baseline=baseline.json \
|
|
114
|
+
--fail-on-new-violations \
|
|
115
|
+
--format=github \
|
|
116
|
+
--no-ai
|
|
117
|
+
|
|
118
|
+
- name: Comment PR
|
|
119
|
+
if: failure()
|
|
120
|
+
uses: actions/github-script@v6
|
|
121
|
+
with:
|
|
122
|
+
script: |
|
|
123
|
+
github.rest.issues.createComment({
|
|
124
|
+
issue_number: context.issue.number,
|
|
125
|
+
owner: context.repo.owner,
|
|
126
|
+
repo: context.repo.repo,
|
|
127
|
+
body: '❌ SunLint found code quality issues. Please check the Actions log for details.'
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
# Job 2: Full Scan + Baseline (comprehensive)
|
|
131
|
+
full-scan:
|
|
132
|
+
if: github.ref == 'refs/heads/main'
|
|
133
|
+
runs-on: ubuntu-latest
|
|
134
|
+
steps:
|
|
135
|
+
- uses: actions/checkout@v3
|
|
136
|
+
|
|
137
|
+
- name: Setup Node.js
|
|
138
|
+
uses: actions/setup-node@v3
|
|
139
|
+
with:
|
|
140
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
141
|
+
|
|
142
|
+
- name: Install SunLint
|
|
143
|
+
run: |
|
|
144
|
+
cd coding-quality/extensions/sunlint
|
|
145
|
+
npm install
|
|
146
|
+
|
|
147
|
+
- name: Run Full SunLint Scan
|
|
148
|
+
run: |
|
|
149
|
+
cd coding-quality/extensions/sunlint
|
|
150
|
+
node cli.js --all --input=. \
|
|
151
|
+
--save-baseline=baseline.json \
|
|
152
|
+
--format=json \
|
|
153
|
+
--output=sunlint-report.json \
|
|
154
|
+
--no-ai
|
|
155
|
+
|
|
156
|
+
- name: Upload Baseline
|
|
157
|
+
uses: actions/upload-artifact@v3
|
|
158
|
+
with:
|
|
159
|
+
name: sunlint-baseline
|
|
160
|
+
path: coding-quality/extensions/sunlint/baseline.json
|
|
161
|
+
retention-days: 30
|
|
162
|
+
|
|
163
|
+
- name: Upload Report
|
|
164
|
+
uses: actions/upload-artifact@v3
|
|
165
|
+
with:
|
|
166
|
+
name: sunlint-report
|
|
167
|
+
path: coding-quality/extensions/sunlint/sunlint-report.json
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### **GitLab CI - Complete Setup**
|
|
171
|
+
|
|
172
|
+
```yaml
|
|
173
|
+
stages:
|
|
174
|
+
- quality-check
|
|
175
|
+
- quality-baseline
|
|
176
|
+
|
|
177
|
+
variables:
|
|
178
|
+
SUNLINT_PATH: "coding-quality/extensions/sunlint"
|
|
179
|
+
|
|
180
|
+
# Fast PR check
|
|
181
|
+
sunlint:pr:
|
|
182
|
+
stage: quality-check
|
|
183
|
+
image: node:18
|
|
184
|
+
rules:
|
|
185
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
186
|
+
before_script:
|
|
187
|
+
- cd $SUNLINT_PATH
|
|
188
|
+
- npm install
|
|
189
|
+
script:
|
|
190
|
+
- |
|
|
191
|
+
if [ -f baseline.json ]; then
|
|
192
|
+
echo "Using existing baseline"
|
|
193
|
+
node cli.js --all --changed-files \
|
|
194
|
+
--diff-base=origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME \
|
|
195
|
+
--baseline=baseline.json \
|
|
196
|
+
--fail-on-new-violations \
|
|
197
|
+
--format=summary \
|
|
198
|
+
--no-ai
|
|
199
|
+
else
|
|
200
|
+
echo "No baseline found, running on changed files only"
|
|
201
|
+
node cli.js --all --changed-files \
|
|
202
|
+
--diff-base=origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME \
|
|
203
|
+
--format=summary \
|
|
204
|
+
--no-ai
|
|
205
|
+
fi
|
|
206
|
+
artifacts:
|
|
207
|
+
reports:
|
|
208
|
+
junit: $SUNLINT_PATH/sunlint-report.xml
|
|
209
|
+
when: always
|
|
210
|
+
expire_in: 1 week
|
|
211
|
+
|
|
212
|
+
# Full scan for main branch
|
|
213
|
+
sunlint:baseline:
|
|
214
|
+
stage: quality-baseline
|
|
215
|
+
image: node:18
|
|
216
|
+
rules:
|
|
217
|
+
- if: $CI_COMMIT_BRANCH == "main"
|
|
218
|
+
before_script:
|
|
219
|
+
- cd $SUNLINT_PATH
|
|
220
|
+
- npm install
|
|
221
|
+
script:
|
|
222
|
+
- |
|
|
223
|
+
node cli.js --all --input=. \
|
|
224
|
+
--save-baseline=baseline.json \
|
|
225
|
+
--format=json \
|
|
226
|
+
--output=sunlint-report.json \
|
|
227
|
+
--no-ai
|
|
228
|
+
artifacts:
|
|
229
|
+
paths:
|
|
230
|
+
- $SUNLINT_PATH/baseline.json
|
|
231
|
+
- $SUNLINT_PATH/sunlint-report.json
|
|
232
|
+
expire_in: 1 month
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## 🎲 **Pre-commit Hook**
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
#!/bin/sh
|
|
239
|
+
# .git/hooks/pre-commit
|
|
240
|
+
|
|
241
|
+
cd coding-quality/extensions/sunlint
|
|
242
|
+
|
|
243
|
+
echo "🔍 Running SunLint on staged files..."
|
|
244
|
+
node cli.js --all --staged-files --format=summary --no-ai
|
|
245
|
+
|
|
246
|
+
if [ $? -ne 0 ]; then
|
|
247
|
+
echo "❌ SunLint found issues. Commit aborted."
|
|
248
|
+
echo "💡 Fix the issues or use 'git commit --no-verify' to bypass."
|
|
249
|
+
exit 1
|
|
250
|
+
fi
|
|
251
|
+
|
|
252
|
+
echo "✅ SunLint passed!"
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## 📈 **Monitoring & Metrics**
|
|
256
|
+
|
|
257
|
+
### **Track Quality Trends**
|
|
258
|
+
```bash
|
|
259
|
+
# Generate trend report
|
|
260
|
+
node cli.js --all --input=. --format=json --output=reports/$(date +%Y-%m-%d).json
|
|
261
|
+
|
|
262
|
+
# Compare with previous scan
|
|
263
|
+
node cli.js --all --input=. --baseline=reports/baseline.json --format=trend
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### **Quality Gates**
|
|
267
|
+
```bash
|
|
268
|
+
# Fail if more than 10 new violations
|
|
269
|
+
node cli.js --all --changed-files --max-new-violations=10
|
|
270
|
+
|
|
271
|
+
# Fail on any security issues
|
|
272
|
+
node cli.js --security --changed-files --severity=error
|
|
273
|
+
|
|
274
|
+
# Allow warnings but fail on errors
|
|
275
|
+
node cli.js --all --changed-files --severity=error
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## 🚨 **Troubleshooting**
|
|
279
|
+
|
|
280
|
+
### **Common Issues**
|
|
281
|
+
|
|
282
|
+
1. **"No changed files detected"**
|
|
283
|
+
```bash
|
|
284
|
+
# Check git status
|
|
285
|
+
git status
|
|
286
|
+
git diff --name-only origin/main
|
|
287
|
+
|
|
288
|
+
# Force include specific files
|
|
289
|
+
node cli.js --all --input=src/specific-file.ts
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
2. **"Baseline not found"**
|
|
293
|
+
```bash
|
|
294
|
+
# Create initial baseline
|
|
295
|
+
node cli.js --all --input=. --save-baseline=baseline.json --no-ai
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
3. **"Too many violations"**
|
|
299
|
+
```bash
|
|
300
|
+
# Focus on high-priority rules first
|
|
301
|
+
node cli.js --rules=C019,S001 --changed-files
|
|
302
|
+
|
|
303
|
+
# Use severity filtering
|
|
304
|
+
node cli.js --all --changed-files --severity=error
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## 🎯 **Best Practices Summary**
|
|
308
|
+
|
|
309
|
+
1. **Start Small**: Begin with changed files only
|
|
310
|
+
2. **Incremental Adoption**: Add rules gradually
|
|
311
|
+
3. **Use Baselines**: For large existing projects
|
|
312
|
+
4. **Monitor Performance**: Track CI execution time
|
|
313
|
+
5. **Focus on New Code**: Don't overwhelm with legacy issues
|
|
314
|
+
6. **Automate Everything**: Pre-commit + PR checks + nightly scans
|
|
315
|
+
7. **Cost Optimization**: Use `--no-ai` for CI to avoid API costs
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# 🎮 SunLint Command Examples & Demos
|
|
2
|
+
|
|
3
|
+
## 📋 **Tổng hợp đầy đủ các chức năng CLI đã hỗ trợ**
|
|
4
|
+
|
|
5
|
+
### ✅ **1. Phạm vi kiểm tra (Input Scope)**
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Kiểm tra 1 file cụ thể
|
|
9
|
+
node cli.js --all --input=cli.js --format=summary --no-ai
|
|
10
|
+
|
|
11
|
+
# Kiểm tra 1 folder/directory
|
|
12
|
+
node cli.js --all --input=core --format=summary --no-ai
|
|
13
|
+
|
|
14
|
+
# Kiểm tra toàn bộ project/workspace
|
|
15
|
+
node cli.js --all --input=. --format=summary --no-ai
|
|
16
|
+
|
|
17
|
+
# Kiểm tra nhiều folders (comma-separated)
|
|
18
|
+
node cli.js --all --input=core,rules --format=summary --no-ai
|
|
19
|
+
|
|
20
|
+
# Kiểm tra chỉ files đã thay đổi (Git integration)
|
|
21
|
+
node cli.js --all --changed-files --format=summary --no-ai
|
|
22
|
+
|
|
23
|
+
# Kiểm tra chỉ files đã staged (Pre-commit)
|
|
24
|
+
node cli.js --all --staged-files --format=summary --no-ai
|
|
25
|
+
|
|
26
|
+
# Kiểm tra files thay đổi so với branch cụ thể
|
|
27
|
+
node cli.js --all --changed-files --diff-base=origin/main --format=summary
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### ✅ **2. Lựa chọn Rules**
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Kiểm tra 1 rule cụ thể
|
|
34
|
+
node cli.js --rule=C019 --input=. --format=summary --no-ai
|
|
35
|
+
|
|
36
|
+
# Kiểm tra nhiều rules cụ thể
|
|
37
|
+
node cli.js --rules=C019,C006,C029 --input=. --format=summary --no-ai
|
|
38
|
+
|
|
39
|
+
# Kiểm tra tất cả rules
|
|
40
|
+
node cli.js --all --input=. --format=summary --no-ai
|
|
41
|
+
|
|
42
|
+
# Kiểm tra theo category (quality rules)
|
|
43
|
+
node cli.js --quality --input=. --format=summary --no-ai
|
|
44
|
+
|
|
45
|
+
# Kiểm tra theo category (security rules)
|
|
46
|
+
node cli.js --security --input=. --format=summary --no-ai
|
|
47
|
+
|
|
48
|
+
# Loại trừ một số rules cụ thể
|
|
49
|
+
node cli.js --all --exclude-rules=C031 --input=. --format=summary --no-ai
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### ✅ **3. Phương pháp phân tích**
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Pattern-based analysis (free, fast)
|
|
56
|
+
node cli.js --all --input=. --format=summary --no-ai
|
|
57
|
+
|
|
58
|
+
# AI-powered analysis (cost, more accurate)
|
|
59
|
+
node cli.js --all --input=. --format=summary --ai
|
|
60
|
+
|
|
61
|
+
# Hybrid: AI cho rules cụ thể, pattern cho còn lại
|
|
62
|
+
node cli.js --rule=C019 --input=. --ai --format=summary
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### ✅ **4. Output Formats**
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Human-readable summary
|
|
69
|
+
node cli.js --all --input=. --format=summary --no-ai
|
|
70
|
+
|
|
71
|
+
# ESLint-compatible JSON (for IDEs)
|
|
72
|
+
node cli.js --all --input=. --format=eslint --no-ai
|
|
73
|
+
|
|
74
|
+
# Structured JSON (for processing)
|
|
75
|
+
node cli.js --all --input=. --format=json --no-ai
|
|
76
|
+
|
|
77
|
+
# Table format (for reports)
|
|
78
|
+
node cli.js --all --input=. --format=table --no-ai
|
|
79
|
+
|
|
80
|
+
# GitHub Actions format (for CI)
|
|
81
|
+
node cli.js --all --input=. --format=github --no-ai
|
|
82
|
+
|
|
83
|
+
# Save to file
|
|
84
|
+
node cli.js --all --input=. --format=json --output=report.json --no-ai
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### ✅ **5. CI/CD Features**
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# PR Mode: Chỉ check violations mới
|
|
91
|
+
node cli.js --all --changed-files --fail-on-new-violations --format=summary
|
|
92
|
+
|
|
93
|
+
# Baseline comparison
|
|
94
|
+
node cli.js --all --input=. --save-baseline=baseline.json --format=json --no-ai
|
|
95
|
+
node cli.js --all --changed-files --baseline=baseline.json --fail-on-new-violations
|
|
96
|
+
|
|
97
|
+
# Severity filtering
|
|
98
|
+
node cli.js --all --input=. --severity=error --format=summary --no-ai
|
|
99
|
+
|
|
100
|
+
# Language filtering
|
|
101
|
+
node cli.js --all --input=. --languages=typescript,javascript --format=summary
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### ✅ **6. Performance & Advanced Options**
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Control concurrent execution
|
|
108
|
+
node cli.js --all --input=. --max-concurrent=10 --format=summary --no-ai
|
|
109
|
+
|
|
110
|
+
# Set timeout for rules
|
|
111
|
+
node cli.js --all --input=. --timeout=60000 --format=summary --no-ai
|
|
112
|
+
|
|
113
|
+
# Disable caching
|
|
114
|
+
node cli.js --all --input=. --no-cache --format=summary --no-ai
|
|
115
|
+
|
|
116
|
+
# Verbose logging
|
|
117
|
+
node cli.js --all --input=. --verbose --format=summary --no-ai
|
|
118
|
+
|
|
119
|
+
# Quiet mode (errors only)
|
|
120
|
+
node cli.js --all --input=. --quiet --format=summary --no-ai
|
|
121
|
+
|
|
122
|
+
# Debug mode
|
|
123
|
+
node cli.js --all --input=. --debug --format=summary --no-ai
|
|
124
|
+
|
|
125
|
+
# Dry run (show what would be analyzed)
|
|
126
|
+
node cli.js --all --input=. --dry-run --format=summary --no-ai
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## 🚀 **Use Cases & Scenarios**
|
|
130
|
+
|
|
131
|
+
### **Local Development** 🏠
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Quick check before commit
|
|
135
|
+
node cli.js --all --staged-files --format=summary --no-ai
|
|
136
|
+
|
|
137
|
+
# Check current work
|
|
138
|
+
node cli.js --all --changed-files --format=summary --no-ai
|
|
139
|
+
|
|
140
|
+
# Focus on specific issue type
|
|
141
|
+
node cli.js --rule=C019 --input=. --format=summary --no-ai
|
|
142
|
+
|
|
143
|
+
# Deep analysis with AI
|
|
144
|
+
node cli.js --quality --input=src --ai --format=detailed
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### **Code Review** 👀
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Check PR changes
|
|
151
|
+
node cli.js --all --changed-files --diff-base=origin/main --format=github
|
|
152
|
+
|
|
153
|
+
# Focus on security for sensitive changes
|
|
154
|
+
node cli.js --security --changed-files --format=summary --no-ai
|
|
155
|
+
|
|
156
|
+
# New violations only
|
|
157
|
+
node cli.js --all --changed-files --baseline=baseline.json --fail-on-new-violations
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### **CI/CD Pipeline** 🔄
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Fast PR check
|
|
164
|
+
node cli.js --all --changed-files --format=github --no-ai --timeout=30000
|
|
165
|
+
|
|
166
|
+
# Full scan for main branch
|
|
167
|
+
node cli.js --all --input=. --format=json --output=report.json --no-ai
|
|
168
|
+
|
|
169
|
+
# Security-critical check
|
|
170
|
+
node cli.js --security --input=. --severity=error --format=summary --no-ai
|
|
171
|
+
|
|
172
|
+
# Quality gate
|
|
173
|
+
node cli.js --quality --changed-files --max-new-violations=5 --format=summary
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### **Project Health Monitoring** 📊
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Full project assessment
|
|
180
|
+
node cli.js --all --input=. --format=detailed --output=health-report.json --no-ai
|
|
181
|
+
|
|
182
|
+
# Trend analysis
|
|
183
|
+
node cli.js --all --input=. --baseline=last-month.json --format=trend --no-ai
|
|
184
|
+
|
|
185
|
+
# Focus areas
|
|
186
|
+
node cli.js --rules=C019,C029 --input=core --format=table --no-ai
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## 🎯 **Practical Examples**
|
|
190
|
+
|
|
191
|
+
### **Example 1: New Feature Development**
|
|
192
|
+
```bash
|
|
193
|
+
# Day 1: Start development
|
|
194
|
+
node cli.js --all --staged-files --format=summary --no-ai
|
|
195
|
+
|
|
196
|
+
# Day 2: Check progress
|
|
197
|
+
node cli.js --all --changed-files --format=summary --no-ai
|
|
198
|
+
|
|
199
|
+
# Day 3: Pre-review check
|
|
200
|
+
node cli.js --all --changed-files --diff-base=origin/main --format=github --no-ai
|
|
201
|
+
|
|
202
|
+
# Day 4: Final validation
|
|
203
|
+
node cli.js --all --changed-files --ai --format=detailed
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### **Example 2: Legacy Code Improvement**
|
|
207
|
+
```bash
|
|
208
|
+
# Step 1: Baseline assessment
|
|
209
|
+
node cli.js --all --input=legacy-module --save-baseline=legacy-baseline.json --no-ai
|
|
210
|
+
|
|
211
|
+
# Step 2: Focus on critical issues
|
|
212
|
+
node cli.js --security --input=legacy-module --severity=error --format=summary
|
|
213
|
+
|
|
214
|
+
# Step 3: Incremental improvement
|
|
215
|
+
node cli.js --rule=C019 --input=legacy-module --format=summary --no-ai
|
|
216
|
+
|
|
217
|
+
# Step 4: Track progress
|
|
218
|
+
node cli.js --all --input=legacy-module --baseline=legacy-baseline.json --format=trend
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### **Example 3: Team Onboarding**
|
|
222
|
+
```bash
|
|
223
|
+
# Level 1: Basic checks
|
|
224
|
+
node cli.js --rules=C006,C019 --input=. --format=summary --no-ai
|
|
225
|
+
|
|
226
|
+
# Level 2: Quality focus
|
|
227
|
+
node cli.js --quality --input=. --format=table --no-ai
|
|
228
|
+
|
|
229
|
+
# Level 3: Full analysis
|
|
230
|
+
node cli.js --all --input=. --format=detailed --no-ai
|
|
231
|
+
|
|
232
|
+
# Level 4: AI-assisted learning
|
|
233
|
+
node cli.js --all --input=. --ai --verbose --format=detailed
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## 📝 **Command Cheat Sheet**
|
|
237
|
+
|
|
238
|
+
| Task | Command |
|
|
239
|
+
|------|---------|
|
|
240
|
+
| Quick pre-commit check | `node cli.js --all --staged-files --format=summary --no-ai` |
|
|
241
|
+
| PR review | `node cli.js --all --changed-files --diff-base=origin/main --format=github` |
|
|
242
|
+
| Full project scan | `node cli.js --all --input=. --format=json --output=report.json --no-ai` |
|
|
243
|
+
| Security audit | `node cli.js --security --input=. --severity=error --format=summary` |
|
|
244
|
+
| New violations only | `node cli.js --all --changed-files --baseline=baseline.json --fail-on-new-violations` |
|
|
245
|
+
| AI deep analysis | `node cli.js --quality --input=src --ai --format=detailed` |
|
|
246
|
+
| Performance test | `node cli.js --all --input=. --max-concurrent=1 --timeout=10000 --no-ai` |
|
|
247
|
+
| Debug issues | `node cli.js --rule=C019 --input=problematic-file.js --debug --verbose` |
|
|
248
|
+
|
|
249
|
+
## 💡 **Pro Tips**
|
|
250
|
+
|
|
251
|
+
1. **Start with `--no-ai`** for faster feedback, use `--ai` for complex issues
|
|
252
|
+
2. **Use `--changed-files`** in development, `--input=.` for comprehensive checks
|
|
253
|
+
3. **Save baselines** for large projects to track progress over time
|
|
254
|
+
4. **Combine `--severity=error`** with CI to focus on critical issues
|
|
255
|
+
5. **Use `--dry-run`** to understand what will be analyzed before running
|
|
256
|
+
6. **Set `--timeout`** appropriately based on project size and CI time limits
|
package/docs/DEBUG.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# 🐛 Debugging Sunlint
|
|
2
|
+
|
|
3
|
+
## Quick Start
|
|
4
|
+
|
|
5
|
+
### Debug Configurations Available
|
|
6
|
+
|
|
7
|
+
1. **Debug Sunlint CLI** - Debug the main CLI with quality rules
|
|
8
|
+
2. **Debug Sunlint - Single Rule** - Debug a specific rule (C006)
|
|
9
|
+
3. **Debug Sunlint - Multiple Rules** - Debug multiple rules with JSON output
|
|
10
|
+
4. **Debug Sunlint - Custom Input** - Debug with custom input path and format
|
|
11
|
+
5. **Debug Rule Analyzer - C006** - Debug the function naming analyzer
|
|
12
|
+
6. **Debug Rule Analyzer - C019** - Debug the log level analyzer
|
|
13
|
+
7. **Debug Rule Analyzer - C029** - Debug the catch block analyzer
|
|
14
|
+
|
|
15
|
+
### How to Debug
|
|
16
|
+
|
|
17
|
+
1. **Open VS Code** in the sunlint folder
|
|
18
|
+
2. **Press F5** or go to `Run and Debug` panel
|
|
19
|
+
3. **Select a configuration** from the dropdown
|
|
20
|
+
4. **Click Start Debugging** (green play button)
|
|
21
|
+
|
|
22
|
+
### Tasks Available
|
|
23
|
+
|
|
24
|
+
- **Sunlint: Run Quality Check** - Run quality analysis (Ctrl+Shift+P → Tasks: Run Task)
|
|
25
|
+
- **Sunlint: Run Single Rule** - Run a specific rule
|
|
26
|
+
- **Sunlint: Run All Rules** - Run all rules with JSON output
|
|
27
|
+
- **Sunlint: Demo Script** - Run the demo script
|
|
28
|
+
- **Sunlint: Install Dependencies** - Install npm dependencies
|
|
29
|
+
- **Sunlint: Validate Registry** - Validate the rules registry
|
|
30
|
+
|
|
31
|
+
### Breakpoints
|
|
32
|
+
|
|
33
|
+
Set breakpoints in:
|
|
34
|
+
- **cli.js** - Main CLI logic
|
|
35
|
+
- **core/multi-rule-runner.js** - Rule execution
|
|
36
|
+
- **core/config-manager.js** - Configuration loading
|
|
37
|
+
- **core/report-generator.js** - Report generation
|
|
38
|
+
- **rules/*/analyzer.js** - Individual rule analyzers
|
|
39
|
+
|
|
40
|
+
### Debug Environment
|
|
41
|
+
|
|
42
|
+
- **NODE_ENV** is set to `development`
|
|
43
|
+
- **Console** output goes to integrated terminal
|
|
44
|
+
- **Skip Files** configured to ignore Node.js internals
|
|
45
|
+
- **Problem Matcher** configured to parse sunlint output
|
|
46
|
+
|
|
47
|
+
### Configuration Files
|
|
48
|
+
|
|
49
|
+
- **launch.json** - Debug configurations
|
|
50
|
+
- **tasks.json** - Build and test tasks
|
|
51
|
+
- **settings.json** - VS Code workspace settings
|
|
52
|
+
- **extensions.json** - Recommended extensions
|
|
53
|
+
- **sunlint-schema.json** - JSON schema for .sunlint.json files
|
|
54
|
+
|
|
55
|
+
### Tips
|
|
56
|
+
|
|
57
|
+
1. **Use breakpoints** in analyzer files to debug rule logic
|
|
58
|
+
2. **Check Variables panel** to inspect rule results
|
|
59
|
+
3. **Use Debug Console** to test expressions
|
|
60
|
+
4. **Watch expressions** for complex debugging
|
|
61
|
+
5. **Step through code** to understand execution flow
|
|
62
|
+
|
|
63
|
+
### Common Debug Scenarios
|
|
64
|
+
|
|
65
|
+
#### Debug Rule Not Working
|
|
66
|
+
1. Set breakpoint in rule analyzer
|
|
67
|
+
2. Use "Debug Rule Analyzer - C006" configuration
|
|
68
|
+
3. Check if rule is properly detecting violations
|
|
69
|
+
|
|
70
|
+
#### Debug CLI Arguments
|
|
71
|
+
1. Set breakpoint in cli.js
|
|
72
|
+
2. Use "Debug Sunlint CLI" configuration
|
|
73
|
+
3. Check if arguments are parsed correctly
|
|
74
|
+
|
|
75
|
+
#### Debug Report Generation
|
|
76
|
+
1. Set breakpoint in report-generator.js
|
|
77
|
+
2. Use any CLI debug configuration
|
|
78
|
+
3. Check if violations are formatted correctly
|
|
79
|
+
|
|
80
|
+
### JSON Schema Support
|
|
81
|
+
|
|
82
|
+
The workspace includes JSON schema for `.sunlint.json` files, providing:
|
|
83
|
+
- **IntelliSense** for configuration options
|
|
84
|
+
- **Validation** of configuration values
|
|
85
|
+
- **Hover documentation** for properties
|
|
86
|
+
- **Auto-completion** for rule IDs and values
|