@sun-asterisk/sunlint 1.0.5 → 1.0.7
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 +108 -169
- package/README.md +124 -383
- package/config/presets/beginner.json +1 -1
- package/config/presets/ci.json +3 -2
- package/config/presets/recommended.json +1 -1
- package/config/presets/strict.json +3 -2
- package/config/rules-registry.json +60 -0
- package/config/sunlint-schema.json +0 -7
- package/config/typescript/eslint.config.js +4 -0
- package/core/cli-action-handler.js +169 -4
- package/core/cli-program.js +20 -4
- package/core/config-manager.js +91 -11
- package/core/config-merger.js +12 -0
- package/core/file-targeting-service.js +381 -0
- package/core/multi-rule-runner.js +9 -27
- package/core/output-service.js +5 -6
- package/core/rule-mapping-service.js +8 -0
- package/package.json +3 -5
- package/cli-legacy.js +0 -355
- package/docs/AI.md +0 -163
- package/docs/ARCHITECTURE.md +0 -78
- package/docs/CI-CD-GUIDE.md +0 -315
- package/docs/COMMAND-EXAMPLES.md +0 -256
- package/docs/DEBUG.md +0 -86
- package/docs/DISTRIBUTION.md +0 -153
- package/docs/ESLINT-INTEGRATION-STRATEGY.md +0 -392
- package/docs/ESLINT_INTEGRATION.md +0 -238
- package/docs/FOLDER_STRUCTURE.md +0 -59
- package/docs/HEURISTIC_VS_AI.md +0 -113
- package/docs/README.md +0 -32
- package/docs/RELEASE_GUIDE.md +0 -230
- package/docs/RULE-RESPONSIBILITY-MATRIX.md +0 -204
- package/eslint-integration/.eslintrc.js +0 -98
- package/eslint-integration/cli.js +0 -35
- package/eslint-integration/eslint-plugin-custom/c002-no-duplicate-code.js +0 -204
- package/eslint-integration/eslint-plugin-custom/c003-no-vague-abbreviations.js +0 -246
- package/eslint-integration/eslint-plugin-custom/c006-function-name-verb-noun.js +0 -207
- package/eslint-integration/eslint-plugin-custom/c010-limit-block-nesting.js +0 -90
- package/eslint-integration/eslint-plugin-custom/c013-no-dead-code.js +0 -43
- package/eslint-integration/eslint-plugin-custom/c014-abstract-dependency-preferred.js +0 -38
- package/eslint-integration/eslint-plugin-custom/c017-limit-constructor-logic.js +0 -39
- package/eslint-integration/eslint-plugin-custom/c018-no-generic-throw.js +0 -335
- package/eslint-integration/eslint-plugin-custom/c023-no-duplicate-variable-name-in-scope.js +0 -142
- package/eslint-integration/eslint-plugin-custom/c027-limit-function-nesting.js +0 -50
- package/eslint-integration/eslint-plugin-custom/c029-catch-block-logging.js +0 -80
- package/eslint-integration/eslint-plugin-custom/c030-use-custom-error-classes.js +0 -294
- package/eslint-integration/eslint-plugin-custom/c034-no-implicit-return.js +0 -34
- package/eslint-integration/eslint-plugin-custom/c035-no-empty-catch.js +0 -32
- package/eslint-integration/eslint-plugin-custom/c041-no-config-inline.js +0 -64
- package/eslint-integration/eslint-plugin-custom/c042-boolean-name-prefix.js +0 -406
- package/eslint-integration/eslint-plugin-custom/c043-no-console-or-print.js +0 -300
- package/eslint-integration/eslint-plugin-custom/c047-no-duplicate-retry-logic.js +0 -239
- package/eslint-integration/eslint-plugin-custom/c048-no-var-declaration.js +0 -31
- package/eslint-integration/eslint-plugin-custom/c076-one-assert-per-test.js +0 -184
- package/eslint-integration/eslint-plugin-custom/index.js +0 -155
- package/eslint-integration/eslint-plugin-custom/package.json +0 -13
- package/eslint-integration/eslint-plugin-custom/package.json.bak +0 -9
- package/eslint-integration/eslint-plugin-custom/s003-no-unvalidated-redirect.js +0 -86
- package/eslint-integration/eslint-plugin-custom/s005-no-origin-auth.js +0 -95
- package/eslint-integration/eslint-plugin-custom/s006-activation-recovery-secret-not-plaintext.js +0 -69
- package/eslint-integration/eslint-plugin-custom/s008-crypto-agility.js +0 -62
- package/eslint-integration/eslint-plugin-custom/s009-no-insecure-crypto.js +0 -103
- package/eslint-integration/eslint-plugin-custom/s010-no-insecure-random-in-sensitive-context.js +0 -123
- package/eslint-integration/eslint-plugin-custom/s011-no-insecure-uuid.js +0 -66
- package/eslint-integration/eslint-plugin-custom/s012-hardcode-secret.js +0 -71
- package/eslint-integration/eslint-plugin-custom/s014-insecure-tls-version.js +0 -50
- package/eslint-integration/eslint-plugin-custom/s015-insecure-tls-certificate.js +0 -43
- package/eslint-integration/eslint-plugin-custom/s016-sensitive-query-parameter.js +0 -59
- package/eslint-integration/eslint-plugin-custom/s017-no-sql-injection.js +0 -193
- package/eslint-integration/eslint-plugin-custom/s018-positive-input-validation.js +0 -56
- package/eslint-integration/eslint-plugin-custom/s019-no-raw-user-input-in-email.js +0 -113
- package/eslint-integration/eslint-plugin-custom/s020-no-eval-dynamic-execution.js +0 -89
- package/eslint-integration/eslint-plugin-custom/s022-output-encoding.js +0 -78
- package/eslint-integration/eslint-plugin-custom/s023-no-json-injection.js +0 -300
- package/eslint-integration/eslint-plugin-custom/s025-server-side-input-validation.js +0 -217
- package/eslint-integration/eslint-plugin-custom/s026-json-schema-validation.js +0 -68
- package/eslint-integration/eslint-plugin-custom/s027-no-hardcoded-secrets.js +0 -80
- package/eslint-integration/eslint-plugin-custom/s029-require-csrf-protection.js +0 -79
- package/eslint-integration/eslint-plugin-custom/s030-no-directory-browsing.js +0 -78
- package/eslint-integration/eslint-plugin-custom/s033-require-samesite-cookie.js +0 -80
- package/eslint-integration/eslint-plugin-custom/s034-require-host-cookie-prefix.js +0 -77
- package/eslint-integration/eslint-plugin-custom/s035-cookie-specific-path.js +0 -74
- package/eslint-integration/eslint-plugin-custom/s036-no-unsafe-file-include.js +0 -68
- package/eslint-integration/eslint-plugin-custom/s037-require-anti-cache-headers.js +0 -70
- package/eslint-integration/eslint-plugin-custom/s038-no-version-disclosure.js +0 -74
- package/eslint-integration/eslint-plugin-custom/s039-no-session-token-in-url.js +0 -63
- package/eslint-integration/eslint-plugin-custom/s041-require-session-invalidate-on-logout.js +0 -211
- package/eslint-integration/eslint-plugin-custom/s042-require-periodic-reauthentication.js +0 -294
- package/eslint-integration/eslint-plugin-custom/s043-terminate-sessions-on-password-change.js +0 -254
- package/eslint-integration/eslint-plugin-custom/s044-require-full-session-for-sensitive-operations.js +0 -292
- package/eslint-integration/eslint-plugin-custom/s045-anti-automation-controls.js +0 -46
- package/eslint-integration/eslint-plugin-custom/s046-secure-notification-on-auth-change.js +0 -44
- package/eslint-integration/eslint-plugin-custom/s047-secure-random-passwords.js +0 -108
- package/eslint-integration/eslint-plugin-custom/s048-password-credential-recovery.js +0 -54
- package/eslint-integration/eslint-plugin-custom/s050-session-token-weak-hash.js +0 -94
- package/eslint-integration/eslint-plugin-custom/s052-secure-random-authentication-code.js +0 -66
- package/eslint-integration/eslint-plugin-custom/s054-verification-default-account.js +0 -109
- package/eslint-integration/eslint-plugin-custom/s055-verification-rest-check-the-incoming-content-type.js +0 -143
- package/eslint-integration/eslint-plugin-custom/s057-utc-logging.js +0 -54
- package/eslint-integration/eslint-plugin-custom/s058-no-ssrf.js +0 -73
- package/eslint-integration/eslint-plugin-custom/t002-interface-prefix-i.js +0 -42
- package/eslint-integration/eslint-plugin-custom/t003-ts-ignore-reason.js +0 -48
- package/eslint-integration/eslint-plugin-custom/t004-interface-public-only.js +0 -160
- package/eslint-integration/eslint-plugin-custom/t007-no-fn-in-constructor.js +0 -52
- package/eslint-integration/eslint-plugin-custom/t011-no-real-time-dependency.js +0 -175
- package/eslint-integration/eslint-plugin-custom/t019-no-empty-type.js +0 -95
- package/eslint-integration/eslint-plugin-custom/t025-no-nested-union-tuple.js +0 -48
- package/eslint-integration/eslint-plugin-custom/t026-limit-nested-generics.js +0 -377
- package/eslint-integration/eslint.config.js +0 -125
- package/eslint-integration/eslint.config.simple.js +0 -24
- package/eslint-integration/node_modules/eslint-plugin-custom/package.json +0 -0
- package/eslint-integration/package.json +0 -23
- package/eslint-integration/sample.ts +0 -53
- package/eslint-integration/test-s003.js +0 -5
- package/eslint-integration/tsconfig.json +0 -27
- package/examples/.github/workflows/code-quality.yml +0 -111
- package/examples/.sunlint.json +0 -42
- package/examples/README.md +0 -47
- package/examples/package.json +0 -33
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
name: Code Quality & Security Check
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
branches: [main, develop]
|
|
6
|
-
push:
|
|
7
|
-
branches: [main]
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
# Parallel execution for faster CI
|
|
11
|
-
eslint:
|
|
12
|
-
name: ESLint Check
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v4
|
|
16
|
-
with:
|
|
17
|
-
fetch-depth: 0
|
|
18
|
-
|
|
19
|
-
- name: Setup Node.js
|
|
20
|
-
uses: actions/setup-node@v4
|
|
21
|
-
with:
|
|
22
|
-
node-version: '18'
|
|
23
|
-
cache: 'npm'
|
|
24
|
-
|
|
25
|
-
- name: Install dependencies
|
|
26
|
-
run: npm ci
|
|
27
|
-
|
|
28
|
-
- name: Run ESLint on changed files
|
|
29
|
-
if: github.event_name == 'pull_request'
|
|
30
|
-
run: |
|
|
31
|
-
CHANGED_FILES=$(git diff --name-only --diff-filter=AM origin/${{ github.base_ref }} | grep -E '\.(js|ts|tsx)$' | tr '\n' ' ')
|
|
32
|
-
if [ ! -z "$CHANGED_FILES" ]; then
|
|
33
|
-
npx eslint $CHANGED_FILES
|
|
34
|
-
else
|
|
35
|
-
echo "No JS/TS files changed"
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
- name: Run ESLint full scan
|
|
39
|
-
if: github.event_name == 'push'
|
|
40
|
-
run: npm run lint:eslint
|
|
41
|
-
|
|
42
|
-
sunlint:
|
|
43
|
-
name: SunLint Security & Quality Check
|
|
44
|
-
runs-on: ubuntu-latest
|
|
45
|
-
steps:
|
|
46
|
-
- uses: actions/checkout@v4
|
|
47
|
-
with:
|
|
48
|
-
fetch-depth: 0
|
|
49
|
-
|
|
50
|
-
- name: Setup Node.js
|
|
51
|
-
uses: actions/setup-node@v4
|
|
52
|
-
with:
|
|
53
|
-
node-version: '18'
|
|
54
|
-
cache: 'npm'
|
|
55
|
-
|
|
56
|
-
- name: Install dependencies
|
|
57
|
-
run: npm ci
|
|
58
|
-
|
|
59
|
-
- name: Install SunLint
|
|
60
|
-
run: npm install -g @sun/sunlint
|
|
61
|
-
|
|
62
|
-
- name: Run SunLint on changed files (PR)
|
|
63
|
-
if: github.event_name == 'pull_request'
|
|
64
|
-
run: |
|
|
65
|
-
sunlint --all --changed-files --diff-base=origin/${{ github.base_ref }} \
|
|
66
|
-
--format=github --fail-on-new-violations
|
|
67
|
-
|
|
68
|
-
- name: Run SunLint full scan (Main)
|
|
69
|
-
if: github.event_name == 'push'
|
|
70
|
-
run: |
|
|
71
|
-
sunlint --all --input=. --format=json \
|
|
72
|
-
--save-baseline=sunlint-baseline.json --output=sunlint-report.json
|
|
73
|
-
|
|
74
|
-
- name: Upload SunLint Baseline
|
|
75
|
-
if: github.event_name == 'push'
|
|
76
|
-
uses: actions/upload-artifact@v4
|
|
77
|
-
with:
|
|
78
|
-
name: sunlint-baseline
|
|
79
|
-
path: sunlint-baseline.json
|
|
80
|
-
|
|
81
|
-
- name: Upload SunLint Report
|
|
82
|
-
if: always()
|
|
83
|
-
uses: actions/upload-artifact@v4
|
|
84
|
-
with:
|
|
85
|
-
name: sunlint-report
|
|
86
|
-
path: sunlint-report.json
|
|
87
|
-
|
|
88
|
-
# Combined summary job
|
|
89
|
-
quality-gate:
|
|
90
|
-
name: Quality Gate
|
|
91
|
-
runs-on: ubuntu-latest
|
|
92
|
-
needs: [eslint, sunlint]
|
|
93
|
-
if: always()
|
|
94
|
-
steps:
|
|
95
|
-
- name: Check ESLint Status
|
|
96
|
-
if: needs.eslint.result != 'success'
|
|
97
|
-
run: |
|
|
98
|
-
echo "❌ ESLint check failed"
|
|
99
|
-
exit 1
|
|
100
|
-
|
|
101
|
-
- name: Check SunLint Status
|
|
102
|
-
if: needs.sunlint.result != 'success'
|
|
103
|
-
run: |
|
|
104
|
-
echo "❌ SunLint check failed"
|
|
105
|
-
exit 1
|
|
106
|
-
|
|
107
|
-
- name: Quality Gate Passed
|
|
108
|
-
run: |
|
|
109
|
-
echo "✅ All quality checks passed!"
|
|
110
|
-
echo "📊 ESLint: ${{ needs.eslint.result }}"
|
|
111
|
-
echo "🔒 SunLint: ${{ needs.sunlint.result }}"
|
package/examples/.sunlint.json
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["@sun/sunlint/recommended"],
|
|
3
|
-
"rules": {
|
|
4
|
-
// SunLint Security Rules
|
|
5
|
-
"S003": "warn", // URL Redirect Validation
|
|
6
|
-
"S047": "warn", // Secure Random Password Generation
|
|
7
|
-
"S055": "warn", // REST Content-Type Verification
|
|
8
|
-
"C006": "error", // Function Naming Convention
|
|
9
|
-
"C019": "error" // Log Level Usage
|
|
10
|
-
},
|
|
11
|
-
"eslint": {
|
|
12
|
-
"enabled": true,
|
|
13
|
-
"runBefore": true,
|
|
14
|
-
"configPath": ".eslintrc.js",
|
|
15
|
-
"rules": {
|
|
16
|
-
// Keep existing ESLint rules
|
|
17
|
-
"no-unused-vars": "error",
|
|
18
|
-
"prefer-const": "error",
|
|
19
|
-
"no-var": "error",
|
|
20
|
-
"@typescript-eslint/no-explicit-any": "warn"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"ignorePatterns": [
|
|
24
|
-
"**/node_modules/**",
|
|
25
|
-
"**/dist/**",
|
|
26
|
-
"**/build/**",
|
|
27
|
-
"**/coverage/**",
|
|
28
|
-
"**/*.d.ts"
|
|
29
|
-
],
|
|
30
|
-
"languages": ["typescript", "javascript"],
|
|
31
|
-
"include": ["src/**", "tests/**"],
|
|
32
|
-
"exclude": ["**/node_modules/**"],
|
|
33
|
-
"output": {
|
|
34
|
-
"format": "eslint",
|
|
35
|
-
"console": true,
|
|
36
|
-
"summary": true
|
|
37
|
-
},
|
|
38
|
-
"ai": {
|
|
39
|
-
"enabled": false,
|
|
40
|
-
"fallbackToPattern": true
|
|
41
|
-
}
|
|
42
|
-
}
|
package/examples/README.md
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# SunLint Configuration Examples
|
|
2
|
-
|
|
3
|
-
This directory contains example configurations and workflows for SunLint integration.
|
|
4
|
-
|
|
5
|
-
## Configuration Examples
|
|
6
|
-
|
|
7
|
-
### 📋 **Project Configuration**
|
|
8
|
-
- **`.sunlint.json`** - Complete project configuration example
|
|
9
|
-
- **`package.json`** - NPM scripts and dependencies setup
|
|
10
|
-
|
|
11
|
-
### 🚀 **CI/CD Examples**
|
|
12
|
-
- **`.github/workflows/code-quality.yml`** - GitHub Actions workflow
|
|
13
|
-
|
|
14
|
-
## Usage
|
|
15
|
-
|
|
16
|
-
### Copy Configuration
|
|
17
|
-
```bash
|
|
18
|
-
# Copy base configuration to your project
|
|
19
|
-
cp examples/.sunlint.json your-project/.sunlint.json
|
|
20
|
-
|
|
21
|
-
# Copy GitHub Actions workflow
|
|
22
|
-
cp examples/.github/workflows/code-quality.yml .github/workflows/
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### Customize Rules
|
|
26
|
-
```json
|
|
27
|
-
{
|
|
28
|
-
"extends": ["@sun/sunlint/recommended"],
|
|
29
|
-
"rules": {
|
|
30
|
-
"C006": "error", // Function naming
|
|
31
|
-
"C019": "error", // Log level usage
|
|
32
|
-
"S005": "warn", // Security rules
|
|
33
|
-
"S012": "error" // No hardcoded secrets
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Integration Patterns
|
|
39
|
-
|
|
40
|
-
1. **TypeScript Projects**: Use with ESLint integration
|
|
41
|
-
2. **CI/CD**: GitHub Actions with changed files only
|
|
42
|
-
3. **Pre-commit**: Staged files validation
|
|
43
|
-
4. **Full scan**: Baseline creation for large projects
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
**For test projects, see `test/` directory**
|
package/examples/package.json
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "example-project",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"scripts": {
|
|
5
|
-
"lint": "npm run lint:eslint && npm run lint:sunlint",
|
|
6
|
-
"lint:eslint": "eslint src/",
|
|
7
|
-
"lint:sunlint": "sunlint --all --input=src",
|
|
8
|
-
"lint:changed": "npm run lint:eslint:changed && npm run lint:sunlint:changed",
|
|
9
|
-
"lint:eslint:changed": "eslint $(git diff --name-only --diff-filter=AM origin/main | grep -E '\\.(js|ts|tsx)$' | tr '\\n' ' ')",
|
|
10
|
-
"lint:sunlint:changed": "sunlint --all --changed-files --diff-base=origin/main",
|
|
11
|
-
"lint:fix": "npm run lint:eslint:fix && npm run lint:sunlint:fix",
|
|
12
|
-
"lint:eslint:fix": "eslint src/ --fix",
|
|
13
|
-
"lint:sunlint:fix": "sunlint --all --input=src --fix"
|
|
14
|
-
},
|
|
15
|
-
"devDependencies": {
|
|
16
|
-
"@sun/sunlint": "^1.0.5",
|
|
17
|
-
"eslint": "^8.57.0"
|
|
18
|
-
},
|
|
19
|
-
"sunlint": {
|
|
20
|
-
"extends": ["@sun/sunlint/recommended"],
|
|
21
|
-
"rules": {
|
|
22
|
-
"S003": "warn",
|
|
23
|
-
"C006": "error",
|
|
24
|
-
"S047": "warn"
|
|
25
|
-
},
|
|
26
|
-
"ignorePatterns": ["**/test/**", "**/cypress/**"],
|
|
27
|
-
"eslint": {
|
|
28
|
-
"enabled": true,
|
|
29
|
-
"runBefore": true,
|
|
30
|
-
"configPath": ".eslintrc.js"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|