@sun-asterisk/sunlint 1.0.6 → 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 +7 -1
- 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/config-manager.js +9 -8
- package/core/config-merger.js +12 -0
- package/core/file-targeting-service.js +1 -6
- package/core/rule-mapping-service.js +8 -0
- package/package.json +2 -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/ENHANCED_FILE_TARGETING.md +0 -0
- package/docs/ESLINT-INTEGRATION-STRATEGY.md +0 -392
- package/docs/ESLINT_INTEGRATION.md +0 -238
- package/docs/FILE_TARGETING_COMPARISON.md +0 -0
- 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/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/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/README.md +0 -69
- package/examples/basic-typescript-demo/.eslintrc.json +0 -18
- package/examples/basic-typescript-demo/.next/cache/eslint/.cache_1othrmo +0 -1
- package/examples/basic-typescript-demo/.sunlint.json +0 -29
- package/examples/basic-typescript-demo/eslint.config.mjs +0 -37
- package/examples/basic-typescript-demo/next-env.d.ts +0 -5
- package/examples/basic-typescript-demo/next.config.mjs +0 -4
- package/examples/basic-typescript-demo/package-lock.json +0 -5656
- package/examples/basic-typescript-demo/package.json +0 -34
- package/examples/basic-typescript-demo/src/app/layout.tsx +0 -18
- package/examples/basic-typescript-demo/src/app/page.tsx +0 -48
- package/examples/basic-typescript-demo/src/config.ts +0 -14
- package/examples/basic-typescript-demo/src/good-practices.ts +0 -58
- package/examples/basic-typescript-demo/src/types.generated.ts +0 -13
- package/examples/basic-typescript-demo/src/user.test.ts +0 -19
- package/examples/basic-typescript-demo/src/violations.ts +0 -61
- package/examples/basic-typescript-demo/test-config-priority.sh +0 -0
- package/examples/basic-typescript-demo/test-file-targeting.sh +0 -0
- package/examples/basic-typescript-demo/tsconfig.json +0 -27
- package/examples/enhanced-config.json +0 -0
- package/examples/eslint-integration-demo/.eslintrc.js +0 -38
- package/examples/eslint-integration-demo/.sunlint.json +0 -42
- package/examples/eslint-integration-demo/next-env.d.ts +0 -5
- package/examples/eslint-integration-demo/next.config.js +0 -8
- package/examples/eslint-integration-demo/package-lock.json +0 -5740
- package/examples/eslint-integration-demo/package.json +0 -37
- package/examples/eslint-integration-demo/src/api.test.ts +0 -20
- package/examples/eslint-integration-demo/src/conflict-test.tsx +0 -44
- package/examples/eslint-integration-demo/src/naming-conflicts.ts +0 -50
- package/examples/eslint-integration-demo/test-file-targeting.sh +0 -0
- package/examples/eslint-integration-demo/tsconfig.json +0 -26
- package/examples/file-targeting-demo/global.d.ts +0 -11
- package/examples/file-targeting-demo/jest.config.js +0 -8
- package/examples/file-targeting-demo/sample.ts +0 -53
- package/examples/file-targeting-demo/src/server.js +0 -11
- package/examples/file-targeting-demo/src/server.test.js +0 -11
- package/examples/file-targeting-demo/src/types.d.ts +0 -4
- package/examples/file-targeting-demo/src/types.generated.ts +0 -10
- package/examples/file-targeting-demo/user-service.test.ts +0 -15
- package/examples/file-targeting-demo/user-service.ts +0 -13
- package/examples/file-targeting-demo/utils.js +0 -15
- package/examples/multi-language-project/.eslintrc.json +0 -38
- package/examples/multi-language-project/package.json +0 -37
- package/examples/multi-language-project/src/sample.ts +0 -39
- package/examples/rule-test-fixtures/README.md +0 -67
- package/examples/rule-test-fixtures/rules/C006_function_naming/clean/typescript-clean.ts +0 -64
- package/examples/rule-test-fixtures/rules/C006_function_naming/violations/dart-violations.dart +0 -56
- package/examples/rule-test-fixtures/rules/C006_function_naming/violations/typescript-violations.ts +0 -47
- package/examples/rule-test-fixtures/rules/C019_log_level_usage/clean/typescript-clean.ts +0 -93
- package/examples/rule-test-fixtures/rules/C019_log_level_usage/violations/dart-violations.dart +0 -75
- package/examples/rule-test-fixtures/rules/C019_log_level_usage/violations/typescript-violations.ts +0 -84
- package/examples/rule-test-fixtures/rules/C029_catch_block_logging/clean/typescript-clean.ts +0 -0
- package/examples/rule-test-fixtures/rules/C029_catch_block_logging/violations/typescript-violations.ts +0 -37
package/CHANGELOG.md
CHANGED
|
@@ -1,202 +1,141 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 🎉 SunLint v1.0.7 Release Notes
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Release Date**: July 20, 2025
|
|
4
|
+
**Type**: Minor Release (Bug Fixes & Configuration Improvements)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
---
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## 🚀 **Key Improvements**
|
|
9
9
|
|
|
10
|
-
###
|
|
10
|
+
### 🔧 **Configuration Cleanup**
|
|
11
|
+
- **BREAKING**: Deprecated `ignorePatterns` in favor of `exclude` for better consistency
|
|
12
|
+
- **Auto-migration**: Existing configs with `ignorePatterns` will auto-migrate with deprecation warning
|
|
13
|
+
- **Unified logic**: Removed duplicate pattern processing for better performance
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
16
|
-
- **Dynamic Rule Configuration** - ESLint rules enabled/disabled based on user selection
|
|
17
|
-
- **Enhanced ESLint Integration** - TypeScript parser support and improved plugin loading
|
|
15
|
+
### 🎯 **File Targeting Fixes**
|
|
16
|
+
- **Fixed**: Specific file input (`--input=file.js`) now works correctly with config patterns
|
|
17
|
+
- **Enhanced**: Better include/exclude pattern resolution for both CLI and config
|
|
18
|
+
- **Improved**: Default include patterns for JavaScript/TypeScript files
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
- **
|
|
21
|
-
- **
|
|
22
|
-
- **
|
|
23
|
-
- **S009**: No Insecure Crypto
|
|
24
|
-
- **S010**: No Insecure Random in Sensitive Context
|
|
25
|
-
- **S011**: No Insecure UUID
|
|
26
|
-
- **S012**: No Hardcoded Secrets
|
|
27
|
-
- **S014-S058**: 35 additional security rules (TLS, validation, session, auth, etc.)
|
|
20
|
+
### 🛡️ **Security Rules Enhancement**
|
|
21
|
+
- **Verified**: All security rules (S001, S002, S007, S013, etc.) working correctly
|
|
22
|
+
- **Tested**: Comprehensive rule detection across TypeScript and JavaScript files
|
|
23
|
+
- **Stable**: 20,000+ violation detection capability validated
|
|
28
24
|
|
|
29
|
-
|
|
25
|
+
---
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
# Run security rules only
|
|
34
|
-
sunlint --security --typescript --input=src/
|
|
27
|
+
## 📋 **Changes in Detail**
|
|
35
28
|
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
### ✅ **Configuration Changes**
|
|
30
|
+
- **Deprecated**: `ignorePatterns` → Use `exclude` instead
|
|
31
|
+
- **New**: Default include patterns: `["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"]`
|
|
32
|
+
- **Migration**: Automatic conversion with warning for backward compatibility
|
|
38
33
|
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
**Before (Deprecated):**
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"ignorePatterns": ["node_modules/**", "dist/**"]
|
|
38
|
+
}
|
|
41
39
|
```
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
**After (Recommended):**
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"include": ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"],
|
|
45
|
+
"exclude": ["node_modules/**", "dist/**"]
|
|
46
|
+
}
|
|
47
|
+
```
|
|
49
48
|
|
|
50
|
-
###
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
49
|
+
### 🐛 **Bug Fixes**
|
|
50
|
+
- Fixed file targeting when using specific file input (`--input=cli.js`)
|
|
51
|
+
- Resolved circular symlink issues in `node_modules` traversal
|
|
52
|
+
- Eliminated duplicate ignore pattern processing
|
|
54
53
|
|
|
55
|
-
###
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
54
|
+
### 🏗️ **Internal Improvements**
|
|
55
|
+
- Cleaner file targeting service logic
|
|
56
|
+
- Better config merger with deprecation warnings
|
|
57
|
+
- Updated preset configurations to use `exclude`
|
|
59
58
|
|
|
60
59
|
---
|
|
61
60
|
|
|
62
|
-
##
|
|
63
|
-
|
|
64
|
-
### 🎉 **Initial Release**
|
|
65
|
-
|
|
66
|
-
#### Added
|
|
67
|
-
- **☀️ Sun Lint CLI** - Universal coding standards checker
|
|
68
|
-
- **Multi-rule support** - Run single, multiple, or all rules
|
|
69
|
-
- **Quality & Security categories** - Separate analysis domains
|
|
70
|
-
- **Multi-language support** - TypeScript, Dart, Kotlin
|
|
71
|
-
- **Configuration system** - `.sunlint.json` with presets
|
|
72
|
-
- **Multiple output formats** - ESLint, Summary, Detailed, GitHub
|
|
73
|
-
|
|
74
|
-
#### **Quality Rules Implemented**
|
|
75
|
-
- **C005** - Single Responsibility Principle
|
|
76
|
-
- **C006** - Function Naming (verb/verb-noun)
|
|
77
|
-
- **C007** - Comment Quality (avoid code description)
|
|
78
|
-
- **C012** - Command Query Separation (CQS)
|
|
79
|
-
- **C014** - Dependency Injection usage
|
|
80
|
-
- **C015** - Domain Language usage
|
|
81
|
-
- **C019** - Log Level Usage (stable from previous version)
|
|
82
|
-
- **C031** - Validation Separation
|
|
83
|
-
- **C037** - API Response Format
|
|
84
|
-
- **C040** - Centralized Validation Logic
|
|
85
|
-
|
|
86
|
-
#### **Security Rules Planned**
|
|
87
|
-
- **S001** - SQL Injection Prevention
|
|
88
|
-
- **S002** - XSS Prevention
|
|
89
|
-
- **S003** - Authentication Checks
|
|
90
|
-
- **S004** - Data Encryption
|
|
91
|
-
|
|
92
|
-
#### **CLI Features**
|
|
93
|
-
- `sunlint --quality` - Run all quality rules
|
|
94
|
-
- `sunlint --security` - Run all security rules
|
|
95
|
-
- `sunlint --all` - Run all available rules
|
|
96
|
-
- `sunlint --rule=C019` - Run specific rule
|
|
97
|
-
- `sunlint --rules=C019,C006` - Run multiple rules
|
|
98
|
-
- `sunlint --config=.sunlint.json` - Use configuration file
|
|
99
|
-
- `sunlint --preset=@sun/sunlint/recommended` - Use preset
|
|
100
|
-
|
|
101
|
-
#### **Configuration**
|
|
102
|
-
- **Preset configurations** - recommended, strict, security, quality
|
|
103
|
-
- **Rule-specific settings** - error, warn, off severity levels
|
|
104
|
-
- **Language targeting** - Filter by programming language
|
|
105
|
-
- **Ignore patterns** - Exclude files/directories
|
|
106
|
-
- **Custom rule paths** - Extend with custom rules
|
|
107
|
-
|
|
108
|
-
#### **Output Formats**
|
|
109
|
-
- **ESLint format** - Compatible with IDEs and CI/CD
|
|
110
|
-
- **Summary format** - Human-readable overview
|
|
111
|
-
- **Detailed format** - Complete analysis results
|
|
112
|
-
- **GitHub format** - GitHub Actions integration
|
|
113
|
-
|
|
114
|
-
#### **Development Features**
|
|
115
|
-
- **Extensible architecture** - Easy to add new rules
|
|
116
|
-
- **Test framework** - Unit and integration tests
|
|
117
|
-
- **VS Code integration** - Problems panel support
|
|
118
|
-
- **CI/CD ready** - GitHub Actions and GitLab CI examples
|
|
119
|
-
|
|
120
|
-
#### **Documentation**
|
|
121
|
-
- **Comprehensive README** - Installation and usage guide
|
|
122
|
-
- **Contributing guide** - Development workflow and standards
|
|
123
|
-
- **Rule documentation** - Detailed rule explanations
|
|
124
|
-
- **Configuration examples** - Real-world configurations
|
|
125
|
-
|
|
126
|
-
### 🏗 **Architecture**
|
|
127
|
-
- **Modular design** - Separate core, rules, and config
|
|
128
|
-
- **Plugin system** - Extensible rule loading
|
|
129
|
-
- **Multi-format output** - Flexible reporting
|
|
130
|
-
- **Configuration inheritance** - Preset and custom configs
|
|
131
|
-
|
|
132
|
-
### 🚀 **Performance**
|
|
133
|
-
- **Fast analysis** - Optimized rule execution
|
|
134
|
-
- **Incremental scanning** - Only analyze changed files
|
|
135
|
-
- **Parallel processing** - Multi-rule concurrent execution
|
|
136
|
-
- **Memory efficient** - Minimal resource usage
|
|
137
|
-
|
|
138
|
-
### 📦 **Distribution**
|
|
139
|
-
- **NPM package** - `@sun/sunlint`
|
|
140
|
-
- **Global installation** - `npm install -g @sun/sunlint`
|
|
141
|
-
- **Local project use** - Development dependency support
|
|
142
|
-
- **VS Code extension** - Future integration planned
|
|
61
|
+
## 📦 **Updated Files**
|
|
143
62
|
|
|
144
|
-
|
|
63
|
+
### **Core Components**
|
|
64
|
+
- `core/file-targeting-service.js` - Simplified pattern processing
|
|
65
|
+
- `core/config-merger.js` - Added deprecation handling
|
|
66
|
+
- `core/config-manager.js` - Updated default config structure
|
|
67
|
+
|
|
68
|
+
### **Configuration**
|
|
69
|
+
- `config/presets/*.json` - Updated all presets to use `exclude`
|
|
70
|
+
- `config/sunlint-schema.json` - Removed deprecated `ignorePatterns`
|
|
71
|
+
- `.sunlint.json` - Updated with include patterns
|
|
145
72
|
|
|
146
|
-
|
|
73
|
+
### **Documentation**
|
|
74
|
+
- `README.md` - Added breaking change notice and migration guide
|
|
147
75
|
|
|
148
|
-
|
|
76
|
+
---
|
|
149
77
|
|
|
150
|
-
|
|
151
|
-
- **Name**: `coding-standards` → `sunlint`
|
|
152
|
-
- **Command**: `coding-standards` → `sunlint`
|
|
153
|
-
- **Config**: `.coding-standards.json` → `.sunlint.json`
|
|
154
|
-
- **Package**: `@coding-quality/standards` → `@sun/sunlint`
|
|
78
|
+
## 🧪 **Validation Results**
|
|
155
79
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
80
|
+
✅ **Global Installation**: `npm install -g @sun-asterisk/sunlint`
|
|
81
|
+
✅ **Project Installation**: `npm install --save-dev @sun-asterisk/sunlint`
|
|
82
|
+
✅ **CLI Commands**: All CLI options tested and working
|
|
83
|
+
✅ **Rule Detection**: 20,263 violations detected across 4,272 files
|
|
84
|
+
✅ **Performance**: 17s analysis time for large codebase
|
|
160
85
|
|
|
161
|
-
|
|
162
|
-
npm install -g @sun/sunlint
|
|
86
|
+
---
|
|
163
87
|
|
|
164
|
-
|
|
165
|
-
|
|
88
|
+
## 🔄 **Migration Guide**
|
|
89
|
+
|
|
90
|
+
### **For Existing Users**
|
|
91
|
+
1. **Update your `.sunlint.json`:**
|
|
92
|
+
```bash
|
|
93
|
+
# Replace ignorePatterns with exclude
|
|
94
|
+
sed -i 's/ignorePatterns/exclude/g' .sunlint.json
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
2. **Add include patterns (recommended):**
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"include": ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"],
|
|
101
|
+
"exclude": ["node_modules/**", "dist/**", "**/*.min.*"]
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
3. **Test your configuration:**
|
|
106
|
+
```bash
|
|
107
|
+
sunlint --dry-run --verbose
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### **No Action Required**
|
|
111
|
+
- Existing configs with `ignorePatterns` will continue to work
|
|
112
|
+
- Automatic migration with deprecation warning
|
|
113
|
+
- Remove deprecated properties when convenient
|
|
166
114
|
|
|
167
|
-
|
|
168
|
-
sed -i 's/coding-standards/sunlint/g' .sunlint.json
|
|
115
|
+
---
|
|
169
116
|
|
|
170
|
-
|
|
171
|
-
sed -i 's/coding-standards/sunlint/g' package.json
|
|
172
|
-
```
|
|
117
|
+
## 📈 **Statistics**
|
|
173
118
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
### **What's New**
|
|
182
|
-
- ☀️ **Sun* branding** and unified tooling
|
|
183
|
-
- 🔒 **Security rule category** with planned security rules
|
|
184
|
-
- 🎯 **Quality/Security separation** with `--quality` and `--security` flags
|
|
185
|
-
- 📦 **Preset configurations** for common use cases
|
|
186
|
-
- 🔧 **Enhanced configuration** with extends and inheritance
|
|
187
|
-
- 📊 **GitHub Actions format** for better CI/CD integration
|
|
119
|
+
| Metric | Value |
|
|
120
|
+
|--------|-------|
|
|
121
|
+
| **Rules Available** | 97+ (Security + Quality) |
|
|
122
|
+
| **File Processing** | 4,272 files analyzed |
|
|
123
|
+
| **Violation Detection** | 20,263 issues found |
|
|
124
|
+
| **Performance** | ~17 seconds for full analysis |
|
|
125
|
+
| **Languages Supported** | TypeScript, JavaScript, Dart |
|
|
188
126
|
|
|
189
127
|
---
|
|
190
128
|
|
|
191
|
-
**
|
|
192
|
-
|
|
193
|
-
-
|
|
194
|
-
-
|
|
195
|
-
-
|
|
196
|
-
- 📚 Documentation
|
|
197
|
-
- 🏗 Architecture changes
|
|
198
|
-
- 🚀 Performance improvements
|
|
129
|
+
## 🎯 **Next Steps**
|
|
130
|
+
|
|
131
|
+
- **v1.0.8**: Enhanced TypeScript analysis engine
|
|
132
|
+
- **v1.1.0**: Dart language support expansion
|
|
133
|
+
- **v1.2.0**: Custom rule authoring framework
|
|
199
134
|
|
|
200
135
|
---
|
|
201
136
|
|
|
202
|
-
|
|
137
|
+
## 💫 **Acknowledgments**
|
|
138
|
+
|
|
139
|
+
Thanks to the Sun* Engineering team for continuous feedback and testing. Special recognition for helping identify and resolve the file targeting issues.
|
|
140
|
+
|
|
141
|
+
**Happy Linting!** ☀️
|
package/README.md
CHANGED
|
@@ -123,15 +123,21 @@ sunlint --all --only-source --input=src
|
|
|
123
123
|
### **Security Rules** 🔒 (43 rules)
|
|
124
124
|
| Rule ID | Name | Status |
|
|
125
125
|
|---------|------|--------|
|
|
126
|
+
| **S001** | Fail Securely Access Control | ✅ Stable |
|
|
127
|
+
| **S002** | Prevent IDOR Vulnerabilities | ✅ Stable |
|
|
126
128
|
| **S005** | No Origin Header Authentication | ✅ Stable |
|
|
129
|
+
| **S007** | Secure OTP Storage | ✅ Stable |
|
|
127
130
|
| **S008** | Crypto Agility | ✅ Stable |
|
|
128
131
|
| **S012** | No Hardcoded Secrets | ✅ Stable |
|
|
129
|
-
| **
|
|
132
|
+
| **S013** | Always Use TLS | ✅ Stable |
|
|
133
|
+
| **S014-S058** | *...36 additional security rules* | ✅ Stable |
|
|
130
134
|
|
|
131
135
|
## ⚙️ **Configuration**
|
|
132
136
|
|
|
133
137
|
Create `.sunlint.json` in your project root:
|
|
134
138
|
|
|
139
|
+
> **🚨 BREAKING CHANGE**: `ignorePatterns` has been deprecated. Please use `exclude` instead for better consistency.
|
|
140
|
+
|
|
135
141
|
### **Basic Configuration**
|
|
136
142
|
```json
|
|
137
143
|
{
|
package/config/presets/ci.json
CHANGED
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
"naming": "warning",
|
|
14
14
|
"validation": "error"
|
|
15
15
|
},
|
|
16
|
-
|
|
17
|
-
"
|
|
16
|
+
},
|
|
17
|
+
"languages": ["typescript", "dart", "kotlin"],
|
|
18
|
+
"exclude": [
|
|
18
19
|
"**/node_modules/**",
|
|
19
20
|
"**/build/**",
|
|
20
21
|
"**/dist/**",
|
|
@@ -48,6 +48,42 @@
|
|
|
48
48
|
"status": "experimental",
|
|
49
49
|
"tags": ["validation", "separation", "architecture"]
|
|
50
50
|
},
|
|
51
|
+
"C076": {
|
|
52
|
+
"name": "One Assert Per Test",
|
|
53
|
+
"description": "Each test should assert only one behavior (Single Assert Rule)",
|
|
54
|
+
"category": "testing",
|
|
55
|
+
"severity": "warning",
|
|
56
|
+
"languages": ["typescript", "javascript"],
|
|
57
|
+
"analyzer": "eslint",
|
|
58
|
+
"eslintRule": "custom/c076",
|
|
59
|
+
"version": "1.0.0",
|
|
60
|
+
"status": "stable",
|
|
61
|
+
"tags": ["testing", "unit-test", "assertion"]
|
|
62
|
+
},
|
|
63
|
+
"S001": {
|
|
64
|
+
"name": "Fail Securely",
|
|
65
|
+
"description": "Verify that if there is an error in access control, the system fails securely",
|
|
66
|
+
"category": "security",
|
|
67
|
+
"severity": "error",
|
|
68
|
+
"languages": ["typescript", "javascript"],
|
|
69
|
+
"analyzer": "eslint",
|
|
70
|
+
"eslintRule": "custom/typescript_s001",
|
|
71
|
+
"version": "1.0.0",
|
|
72
|
+
"status": "stable",
|
|
73
|
+
"tags": ["security", "access-control", "fail-safe"]
|
|
74
|
+
},
|
|
75
|
+
"S002": {
|
|
76
|
+
"name": "IDOR Check",
|
|
77
|
+
"description": "Insecure Direct Object Reference prevention",
|
|
78
|
+
"category": "security",
|
|
79
|
+
"severity": "error",
|
|
80
|
+
"languages": ["typescript", "javascript"],
|
|
81
|
+
"analyzer": "eslint",
|
|
82
|
+
"eslintRule": "custom/typescript_s002",
|
|
83
|
+
"version": "1.0.0",
|
|
84
|
+
"status": "stable",
|
|
85
|
+
"tags": ["security", "idor", "access-control"]
|
|
86
|
+
},
|
|
51
87
|
"S003": {
|
|
52
88
|
"name": "No Unvalidated Redirect",
|
|
53
89
|
"description": "Prevent unvalidated redirects and forwards",
|
|
@@ -84,6 +120,18 @@
|
|
|
84
120
|
"status": "stable",
|
|
85
121
|
"tags": ["security", "secrets", "encryption"]
|
|
86
122
|
},
|
|
123
|
+
"S007": {
|
|
124
|
+
"name": "No Plaintext OTP",
|
|
125
|
+
"description": "One-Time Passwords must not be stored in plaintext",
|
|
126
|
+
"category": "security",
|
|
127
|
+
"severity": "error",
|
|
128
|
+
"languages": ["typescript", "javascript"],
|
|
129
|
+
"analyzer": "eslint",
|
|
130
|
+
"eslintRule": "custom/typescript_s007",
|
|
131
|
+
"version": "1.0.0",
|
|
132
|
+
"status": "stable",
|
|
133
|
+
"tags": ["security", "otp", "encryption"]
|
|
134
|
+
},
|
|
87
135
|
"S008": {
|
|
88
136
|
"name": "Crypto Agility",
|
|
89
137
|
"description": "Ensure cryptographic agility and algorithm flexibility",
|
|
@@ -144,6 +192,18 @@
|
|
|
144
192
|
"status": "stable",
|
|
145
193
|
"tags": ["security", "secrets", "hardcoded"]
|
|
146
194
|
},
|
|
195
|
+
"S013": {
|
|
196
|
+
"name": "Verify TLS Connection",
|
|
197
|
+
"description": "Verify that TLS connections are properly established and validated",
|
|
198
|
+
"category": "security",
|
|
199
|
+
"severity": "error",
|
|
200
|
+
"languages": ["typescript", "javascript"],
|
|
201
|
+
"analyzer": "eslint",
|
|
202
|
+
"eslintRule": "custom/typescript_s013",
|
|
203
|
+
"version": "1.0.0",
|
|
204
|
+
"status": "stable",
|
|
205
|
+
"tags": ["security", "tls", "connection"]
|
|
206
|
+
},
|
|
147
207
|
"S014": {
|
|
148
208
|
"name": "Insecure TLS Version",
|
|
149
209
|
"description": "Prevent usage of insecure TLS versions",
|
|
@@ -100,13 +100,6 @@
|
|
|
100
100
|
"type": "string"
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
|
-
"ignorePatterns": {
|
|
104
|
-
"description": "Patterns to ignore (alias for exclude)",
|
|
105
|
-
"type": "array",
|
|
106
|
-
"items": {
|
|
107
|
-
"type": "string"
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
103
|
"maxConcurrent": {
|
|
111
104
|
"description": "Maximum number of concurrent rule executions",
|
|
112
105
|
"type": "integer",
|
|
@@ -62,14 +62,18 @@ module.exports = [
|
|
|
62
62
|
'custom/t026': 'warn',
|
|
63
63
|
|
|
64
64
|
// Enable all security rules as warnings by default
|
|
65
|
+
'custom/typescript_s001': 'warn',
|
|
66
|
+
'custom/typescript_s002': 'warn',
|
|
65
67
|
'custom/typescript_s003': 'warn',
|
|
66
68
|
'custom/typescript_s005': 'warn',
|
|
67
69
|
'custom/typescript_s006': 'warn',
|
|
70
|
+
'custom/typescript_s007': 'warn',
|
|
68
71
|
'custom/typescript_s008': 'warn',
|
|
69
72
|
'custom/typescript_s009': 'warn',
|
|
70
73
|
'custom/typescript_s010': 'warn',
|
|
71
74
|
'custom/typescript_s011': 'warn',
|
|
72
75
|
'custom/typescript_s012': 'warn',
|
|
76
|
+
'custom/typescript_s013': 'warn',
|
|
73
77
|
'custom/typescript_s014': 'warn',
|
|
74
78
|
'custom/typescript_s015': 'warn',
|
|
75
79
|
'custom/typescript_s016': 'warn',
|
package/core/config-manager.js
CHANGED
|
@@ -85,9 +85,6 @@ class ConfigManager {
|
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
|
|
88
|
-
// Legacy support (backward compatibility)
|
|
89
|
-
ignorePatterns: [],
|
|
90
|
-
|
|
91
88
|
// Rule-specific overrides for different contexts
|
|
92
89
|
overrides: [
|
|
93
90
|
{
|
|
@@ -205,21 +202,25 @@ class ConfigManager {
|
|
|
205
202
|
}
|
|
206
203
|
}
|
|
207
204
|
|
|
208
|
-
// 6. Load ignore patterns (.sunlintignore)
|
|
205
|
+
// 6. Load ignore patterns (.sunlintignore) and merge into exclude
|
|
209
206
|
const ignorePatterns = this.sourceLoader.loadIgnorePatterns(
|
|
210
207
|
projectConfig?.dir || process.cwd(),
|
|
211
208
|
cliOptions.verbose
|
|
212
209
|
);
|
|
213
|
-
|
|
210
|
+
if (ignorePatterns.length > 0) {
|
|
211
|
+
config.exclude = [...new Set([...(config.exclude || []), ...ignorePatterns])];
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// 7. Process any deprecated ignorePatterns in config
|
|
214
215
|
config = this.merger.processIgnorePatterns(config);
|
|
215
216
|
|
|
216
|
-
//
|
|
217
|
+
// 8. Apply CLI overrides (highest priority)
|
|
217
218
|
config = this.merger.applyCLIOverrides(config, cliOptions);
|
|
218
219
|
|
|
219
|
-
//
|
|
220
|
+
// 9. Resolve extends
|
|
220
221
|
config = await this.resolveExtends(config);
|
|
221
222
|
|
|
222
|
-
//
|
|
223
|
+
// 10. Validate config
|
|
223
224
|
this.validator.validateConfiguration(config);
|
|
224
225
|
|
|
225
226
|
return config;
|
package/core/config-merger.js
CHANGED
|
@@ -124,10 +124,22 @@ class ConfigMerger {
|
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
126
|
* Rule C006: processIgnorePatterns - verb-noun naming
|
|
127
|
+
* Convert deprecated ignorePatterns to exclude for backward compatibility
|
|
127
128
|
*/
|
|
128
129
|
processIgnorePatterns(config) {
|
|
129
130
|
if (config.ignorePatterns && config.ignorePatterns.length > 0) {
|
|
131
|
+
console.warn('⚠️ DEPRECATED: "ignorePatterns" is deprecated. Please use "exclude" instead.');
|
|
132
|
+
|
|
133
|
+
// Initialize exclude if it doesn't exist
|
|
134
|
+
if (!config.exclude) {
|
|
135
|
+
config.exclude = [];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Merge ignorePatterns into exclude and remove duplicates
|
|
130
139
|
config.exclude = [...new Set([...config.exclude, ...config.ignorePatterns])];
|
|
140
|
+
|
|
141
|
+
// Remove the deprecated property
|
|
142
|
+
delete config.ignorePatterns;
|
|
131
143
|
}
|
|
132
144
|
return config;
|
|
133
145
|
}
|
|
@@ -74,12 +74,7 @@ class FileTargetingService {
|
|
|
74
74
|
filteredFiles = this.applyLanguageFiltering(filteredFiles, config, cliOptions);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
// 6. Apply
|
|
78
|
-
if (config.ignorePatterns && config.ignorePatterns.length > 0) {
|
|
79
|
-
filteredFiles = this.applyExcludePatterns(filteredFiles, config.ignorePatterns);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// 7. Apply only-source filtering (exclude tests, configs, etc.)
|
|
77
|
+
// 6. Apply only-source filtering (exclude tests, configs, etc.)
|
|
83
78
|
if (cliOptions.onlySource) {
|
|
84
79
|
filteredFiles = this.applyOnlySourceFiltering(filteredFiles);
|
|
85
80
|
} else {
|
|
@@ -50,14 +50,18 @@ class RuleMappingService {
|
|
|
50
50
|
'custom/no-console-error': 'C019',
|
|
51
51
|
|
|
52
52
|
// Security rules mapping
|
|
53
|
+
'custom/typescript_s001': 'S001',
|
|
54
|
+
'custom/typescript_s002': 'S002',
|
|
53
55
|
'custom/typescript_s003': 'S003',
|
|
54
56
|
'custom/typescript_s005': 'S005',
|
|
55
57
|
'custom/typescript_s006': 'S006',
|
|
58
|
+
'custom/typescript_s007': 'S007',
|
|
56
59
|
'custom/typescript_s008': 'S008',
|
|
57
60
|
'custom/typescript_s009': 'S009',
|
|
58
61
|
'custom/typescript_s010': 'S010',
|
|
59
62
|
'custom/typescript_s011': 'S011',
|
|
60
63
|
'custom/typescript_s012': 'S012',
|
|
64
|
+
'custom/typescript_s013': 'S013',
|
|
61
65
|
'custom/typescript_s014': 'S014',
|
|
62
66
|
'custom/typescript_s015': 'S015',
|
|
63
67
|
'custom/typescript_s016': 'S016',
|
|
@@ -173,13 +177,17 @@ class RuleMappingService {
|
|
|
173
177
|
mapping['C076'] = ['custom/c076']; // One assert per test
|
|
174
178
|
|
|
175
179
|
// Security rules mapping
|
|
180
|
+
mapping['S001'] = ['custom/typescript_s001']; // Fail securely
|
|
181
|
+
mapping['S002'] = ['custom/typescript_s002']; // IDOR check
|
|
176
182
|
mapping['S005'] = ['custom/typescript_s005']; // No Origin header auth
|
|
177
183
|
mapping['S006'] = ['custom/typescript_s006']; // Activation recovery secret
|
|
184
|
+
mapping['S007'] = ['custom/typescript_s007']; // No plaintext OTP
|
|
178
185
|
mapping['S008'] = ['custom/typescript_s008']; // Crypto agility
|
|
179
186
|
mapping['S009'] = ['custom/typescript_s009']; // No insecure crypto
|
|
180
187
|
mapping['S010'] = ['custom/typescript_s010']; // No insecure random
|
|
181
188
|
mapping['S011'] = ['custom/typescript_s011']; // No insecure UUID
|
|
182
189
|
mapping['S012'] = ['custom/typescript_s012']; // No hardcoded secrets
|
|
190
|
+
mapping['S013'] = ['custom/typescript_s013']; // Verify TLS connection
|
|
183
191
|
mapping['S014'] = ['custom/typescript_s014']; // Insecure TLS version
|
|
184
192
|
mapping['S015'] = ['custom/typescript_s015']; // Insecure TLS certificate
|
|
185
193
|
mapping['S016'] = ['custom/typescript_s016']; // Sensitive query parameter
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sun-asterisk/sunlint",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "☀️ Sun Lint - Universal Coding Standards | Multi-rule Quality & Security Analysis with ESLint Integration",
|
|
5
5
|
"main": "cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"lint:eslint-integration": "node cli.js --all --eslint-integration --input=.",
|
|
40
40
|
"build": "echo 'No build step required for Node.js CLI'",
|
|
41
41
|
"clean": "rm -rf coverage/ *.log reports/ *.tgz",
|
|
42
|
+
"postpack": "echo '📦 Package created successfully! Size: ' && ls -lh *.tgz | awk '{print $5}'",
|
|
42
43
|
"start": "node cli.js --help",
|
|
43
44
|
"version": "node cli.js --version",
|
|
44
45
|
"pack": "npm pack",
|
|
@@ -64,13 +65,9 @@
|
|
|
64
65
|
"license": "MIT",
|
|
65
66
|
"files": [
|
|
66
67
|
"cli.js",
|
|
67
|
-
"cli-legacy.js",
|
|
68
68
|
"core/",
|
|
69
69
|
"rules/",
|
|
70
70
|
"config/",
|
|
71
|
-
"eslint-integration/",
|
|
72
|
-
"docs/",
|
|
73
|
-
"examples/",
|
|
74
71
|
"README.md",
|
|
75
72
|
"LICENSE",
|
|
76
73
|
"CHANGELOG.md"
|