@sun-asterisk/sunlint 1.0.6 → 1.1.3
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/.sunlint.json +35 -0
- package/CHANGELOG.md +135 -169
- package/CONTRIBUTING.md +235 -0
- package/PROJECT_STRUCTURE.md +60 -0
- package/README.md +77 -50
- package/cli.js +1 -0
- package/config/README.md +88 -0
- package/config/defaults/ai-rules-context.json +231 -0
- package/config/engines/engines.json +49 -0
- package/config/engines/eslint-rule-mapping.json +74 -0
- package/config/eslint-rule-mapping.json +126 -0
- package/config/{typescript/eslint.config.js → integrations/eslint/typescript.config.js} +4 -0
- 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 +2 -2
- package/config/rule-analysis-strategies.js +74 -0
- package/config/{rules-registry.json → rules/rules-registry.json} +82 -0
- package/core/analysis-orchestrator.js +383 -591
- package/core/ast-modules/README.md +103 -0
- package/core/ast-modules/base-parser.js +90 -0
- package/core/ast-modules/index.js +97 -0
- package/core/ast-modules/package.json +37 -0
- package/core/ast-modules/parsers/eslint-js-parser.js +147 -0
- package/core/ast-modules/parsers/eslint-ts-parser.js +106 -0
- package/core/ast-modules/parsers/javascript-parser.js +187 -0
- package/core/ast-modules/parsers/typescript-parser.js +187 -0
- package/core/cli-action-handler.js +271 -255
- package/core/cli-program.js +18 -4
- package/core/config-manager.js +18 -11
- package/core/config-merger.js +52 -1
- package/core/config-validator.js +2 -2
- package/core/enhanced-rules-registry.js +331 -0
- package/core/file-targeting-service.js +93 -29
- package/core/interfaces/analysis-engine.interface.js +100 -0
- package/core/multi-rule-runner.js +0 -221
- package/core/output-service.js +1 -1
- package/core/rule-mapping-service.js +9 -1
- package/core/rule-selection-service.js +10 -2
- package/docs/CONFIGURATION.md +414 -0
- package/docs/DEPLOYMENT-STRATEGIES.md +270 -0
- package/engines/eslint-engine.js +601 -0
- package/engines/heuristic-engine.js +860 -0
- package/engines/openai-engine.js +374 -0
- package/integrations/eslint/README.md +99 -0
- package/{eslint-integration → integrations/eslint/configs}/.eslintrc.js +1 -1
- package/integrations/eslint/configs/eslint.config.js +133 -0
- package/integrations/eslint/configs/eslint.config.simple.js +24 -0
- package/integrations/eslint/plugin/index.js +164 -0
- package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/common}/c006-function-name-verb-noun.js +11 -2
- package/integrations/eslint/plugin/rules/common/c013-no-dead-code.js +78 -0
- package/integrations/eslint/plugin/rules/common/c017-limit-constructor-logic.js +146 -0
- package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/common}/c029-catch-block-logging.js +35 -0
- package/integrations/eslint/plugin/rules/common/c035-no-empty-catch.js +162 -0
- package/integrations/eslint/plugin/rules/common/c041-no-config-inline.js +122 -0
- package/integrations/eslint/plugin/rules/common/c072-one-assert-per-test.js +184 -0
- package/integrations/eslint/plugin/rules/common/c075-explicit-function-return-types.js +168 -0
- package/integrations/eslint/plugin/rules/common/c076-single-behavior-per-test.js +254 -0
- package/integrations/eslint/plugin/rules/security/s001-fail-securely.js +381 -0
- package/integrations/eslint/plugin/rules/security/s002-idor-check.js +945 -0
- package/integrations/eslint/plugin/rules/security/s007-no-plaintext-otp.js +74 -0
- package/integrations/eslint/plugin/rules/security/s013-verify-tls-connection.js +47 -0
- package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/typescript}/t003-ts-ignore-reason.js +3 -3
- package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/typescript}/t007-no-fn-in-constructor.js +1 -1
- package/integrations/eslint/plugin/rules/typescript/t019-no-this-assign.js +81 -0
- package/integrations/eslint/plugin/rules/typescript/t020-no-default-multi-export.js +127 -0
- package/integrations/eslint/plugin/rules/typescript/t021-limit-nested-generics.js +150 -0
- package/integrations/eslint/test-c041-rule.js +87 -0
- package/package.json +29 -19
- package/rules/README.md +252 -0
- package/rules/common/C002_no_duplicate_code/analyzer.js +65 -0
- package/rules/common/C002_no_duplicate_code/config.json +23 -0
- package/rules/common/C003_no_vague_abbreviations/analyzer.js +418 -0
- package/rules/common/C003_no_vague_abbreviations/config.json +35 -0
- package/rules/{C006_function_naming → common/C006_function_naming}/analyzer.js +13 -2
- package/rules/common/C010_limit_block_nesting/analyzer.js +389 -0
- package/rules/common/C013_no_dead_code/analyzer.js +206 -0
- package/rules/common/C014_dependency_injection/analyzer.js +338 -0
- package/rules/common/C017_constructor_logic/analyzer.js +314 -0
- package/rules/{C019_log_level_usage → common/C019_log_level_usage}/analyzer.js +5 -2
- package/rules/{C029_catch_block_logging → common/C029_catch_block_logging}/analyzer.js +49 -15
- package/rules/common/C041_no_sensitive_hardcode/analyzer.js +292 -0
- package/rules/common/C042_boolean_name_prefix/analyzer.js +300 -0
- package/rules/common/C043_no_console_or_print/analyzer.js +304 -0
- package/rules/common/C047_no_duplicate_retry_logic/analyzer.js +351 -0
- package/rules/common/C075_explicit_return_types/analyzer.js +103 -0
- package/rules/common/C076_single_test_behavior/analyzer.js +121 -0
- package/rules/docs/C002_no_duplicate_code.md +57 -0
- package/rules/index.js +149 -0
- package/rules/migration/converter.js +385 -0
- package/rules/migration/mapping.json +164 -0
- package/rules/security/S026_json_schema_validation/analyzer.js +251 -0
- package/rules/security/S026_json_schema_validation/config.json +27 -0
- package/rules/security/S027_no_hardcoded_secrets/analyzer.js +263 -0
- package/rules/security/S027_no_hardcoded_secrets/config.json +29 -0
- package/rules/security/S029_csrf_protection/analyzer.js +264 -0
- package/rules/tests/C002_no_duplicate_code.test.js +50 -0
- package/rules/utils/ast-utils.js +191 -0
- package/rules/utils/base-analyzer.js +98 -0
- package/rules/utils/pattern-matchers.js +239 -0
- package/rules/utils/rule-helpers.js +264 -0
- package/rules/utils/severity-constants.js +93 -0
- package/scripts/build-release.sh +117 -0
- package/scripts/ci-report.js +179 -0
- package/scripts/install.sh +196 -0
- package/scripts/manual-release.sh +338 -0
- package/scripts/merge-reports.js +424 -0
- package/scripts/pre-release-test.sh +175 -0
- package/scripts/prepare-release.sh +202 -0
- package/scripts/setup-github-registry.sh +42 -0
- package/scripts/test-scripts/README.md +22 -0
- package/scripts/test-scripts/test-c041-comparison.js +114 -0
- package/scripts/test-scripts/test-c041-eslint.js +67 -0
- package/scripts/test-scripts/test-eslint-rules.js +146 -0
- package/scripts/test-scripts/test-real-world.js +44 -0
- package/scripts/test-scripts/test-rules-on-real-projects.js +86 -0
- package/scripts/trigger-release.sh +285 -0
- package/scripts/validate-rule-structure.js +148 -0
- package/scripts/verify-install.sh +82 -0
- package/cli-legacy.js +0 -355
- package/config/sunlint-schema.json +0 -166
- package/config/typescript/custom-rules-new.js +0 -0
- package/config/typescript/custom-rules.js +0 -9
- package/config/typescript/package-lock.json +0 -1585
- package/config/typescript/package.json +0 -13
- package/config/typescript/security-rules/index.js +0 -90
- package/config/typescript/security-rules/s005-no-origin-auth.js +0 -95
- package/config/typescript/security-rules/s006-activation-recovery-secret-not-plaintext.js +0 -69
- package/config/typescript/security-rules/s008-crypto-agility.js +0 -62
- package/config/typescript/security-rules/s009-no-insecure-crypto.js +0 -103
- package/config/typescript/security-rules/s010-no-insecure-random-in-sensitive-context.js +0 -123
- package/config/typescript/security-rules/s011-no-insecure-uuid.js +0 -66
- package/config/typescript/security-rules/s012-hardcode-secret.js +0 -71
- package/config/typescript/security-rules/s014-insecure-tls-version.js +0 -50
- package/config/typescript/security-rules/s015-insecure-tls-certificate.js +0 -43
- package/config/typescript/security-rules/s016-sensitive-query-parameter.js +0 -59
- package/config/typescript/security-rules/s017-no-sql-injection.js +0 -193
- package/config/typescript/security-rules/s018-positive-input-validation.js +0 -56
- package/config/typescript/security-rules/s019-no-raw-user-input-in-email.js +0 -113
- package/config/typescript/security-rules/s020-no-eval-dynamic-execution.js +0 -89
- package/config/typescript/security-rules/s022-output-encoding.js +0 -78
- package/config/typescript/security-rules/s023-no-json-injection.js +0 -300
- package/config/typescript/security-rules/s025-server-side-input-validation.js +0 -217
- package/config/typescript/security-rules/s026-json-schema-validation.js +0 -68
- package/config/typescript/security-rules/s027-no-hardcoded-secrets.js +0 -80
- package/config/typescript/security-rules/s029-require-csrf-protection.js +0 -79
- package/config/typescript/security-rules/s030-no-directory-browsing.js +0 -78
- package/config/typescript/security-rules/s033-require-samesite-cookie.js +0 -80
- package/config/typescript/security-rules/s034-require-host-cookie-prefix.js +0 -77
- package/config/typescript/security-rules/s035-cookie-specific-path.js +0 -74
- package/config/typescript/security-rules/s036-no-unsafe-file-include.js +0 -68
- package/config/typescript/security-rules/s037-require-anti-cache-headers.js +0 -70
- package/config/typescript/security-rules/s038-no-version-disclosure.js +0 -74
- package/config/typescript/security-rules/s039-no-session-token-in-url.js +0 -63
- package/config/typescript/security-rules/s041-require-session-invalidate-on-logout.js +0 -211
- package/config/typescript/security-rules/s042-require-periodic-reauthentication.js +0 -294
- package/config/typescript/security-rules/s043-terminate-sessions-on-password-change.js +0 -254
- package/config/typescript/security-rules/s044-require-full-session-for-sensitive-operations.js +0 -292
- package/config/typescript/security-rules/s045-anti-automation-controls.js +0 -46
- package/config/typescript/security-rules/s046-secure-notification-on-auth-change.js +0 -44
- package/config/typescript/security-rules/s048-password-credential-recovery.js +0 -54
- package/config/typescript/security-rules/s050-session-token-weak-hash.js +0 -94
- package/config/typescript/security-rules/s052-secure-random-authentication-code.js +0 -66
- package/config/typescript/security-rules/s054-verification-default-account.js +0 -109
- package/config/typescript/security-rules/s057-utc-logging.js +0 -54
- package/config/typescript/security-rules/s058-no-ssrf.js +0 -73
- package/config/typescript/tsconfig.json +0 -29
- package/core/ai-analyzer.js +0 -169
- package/core/eslint-engine-service.js +0 -312
- package/core/eslint-instance-manager.js +0 -104
- package/core/eslint-integration-service.js +0 -363
- package/core/sunlint-engine-service.js +0 -23
- package/core/typescript-analyzer.js +0 -262
- package/core/typescript-engine.js +0 -313
- package/docs/ENHANCED_FILE_TARGETING.md +0 -0
- package/docs/FILE_TARGETING_COMPARISON.md +0 -0
- package/docs/RULE-RESPONSIBILITY-MATRIX.md +0 -204
- package/eslint-integration/cli.js +0 -35
- package/eslint-integration/eslint-plugin-custom/c013-no-dead-code.js +0 -43
- package/eslint-integration/eslint-plugin-custom/c017-limit-constructor-logic.js +0 -39
- package/eslint-integration/eslint-plugin-custom/c027-limit-function-nesting.js +0 -50
- 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/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.bak +0 -9
- package/eslint-integration/eslint-plugin-custom/t004-interface-public-only.js +0 -160
- package/eslint-integration/eslint-plugin-custom/t011-no-real-time-dependency.js +0 -175
- package/eslint-integration/eslint-plugin-custom/t026-limit-nested-generics.js +0 -377
- package/eslint-integration/sample.ts +0 -53
- package/eslint-integration/test-s003.js +0 -5
- 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/tsconfig.json +0 -27
- 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/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/violations/typescript-violations.ts +0 -37
- /package/config/{default.json → defaults/default.json} +0 -0
- /package/{eslint-integration/eslint.config.js → config/integrations/eslint/base.config.js} +0 -0
- /package/{eslint-integration/eslint.config.simple.js → config/integrations/eslint/simple.config.js} +0 -0
- /package/{examples/rule-test-fixtures/rules/C029_catch_block_logging/clean/typescript-clean.ts → config/schemas/sunlint-schema.json} +0 -0
- /package/config/{typescript → testing}/test-s005-working.ts +0 -0
- /package/{examples/eslint-integration-demo/test-file-targeting.sh → engines/tree-sitter-parser.js} +0 -0
- /package/{examples/enhanced-config.json → engines/universal-ast-engine.js} +0 -0
- /package/{eslint-integration → integrations/eslint}/package.json +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin}/package.json +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/common}/c002-no-duplicate-code.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/common}/c003-no-vague-abbreviations.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/common}/c010-limit-block-nesting.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/common}/c014-abstract-dependency-preferred.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/common}/c018-no-generic-throw.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/common}/c023-no-duplicate-variable-name-in-scope.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/common}/c030-use-custom-error-classes.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/common}/c042-boolean-name-prefix.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/common}/c043-no-console-or-print.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/common}/c047-no-duplicate-retry-logic.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s003-no-unvalidated-redirect.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s005-no-origin-auth.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s006-activation-recovery-secret-not-plaintext.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s008-crypto-agility.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s009-no-insecure-crypto.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s010-no-insecure-random-in-sensitive-context.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s011-no-insecure-uuid.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s012-hardcode-secret.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s014-insecure-tls-version.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s015-insecure-tls-certificate.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s016-sensitive-query-parameter.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s017-no-sql-injection.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s018-positive-input-validation.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s019-no-raw-user-input-in-email.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s020-no-eval-dynamic-execution.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s022-output-encoding.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s023-no-json-injection.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s025-server-side-input-validation.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s026-json-schema-validation.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s027-no-hardcoded-secrets.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s029-require-csrf-protection.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s030-no-directory-browsing.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s033-require-samesite-cookie.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s034-require-host-cookie-prefix.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s035-cookie-specific-path.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s036-no-unsafe-file-include.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s037-require-anti-cache-headers.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s038-no-version-disclosure.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s039-no-session-token-in-url.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s041-require-session-invalidate-on-logout.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s042-require-periodic-reauthentication.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s043-terminate-sessions-on-password-change.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s044-require-full-session-for-sensitive-operations.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s045-anti-automation-controls.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s046-secure-notification-on-auth-change.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s047-secure-random-passwords.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s048-password-credential-recovery.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s050-session-token-weak-hash.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s052-secure-random-authentication-code.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s054-verification-default-account.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s055-verification-rest-check-the-incoming-content-type.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s057-utc-logging.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/security}/s058-no-ssrf.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom → integrations/eslint/plugin/rules/typescript}/t002-interface-prefix-i.js +0 -0
- /package/{eslint-integration/eslint-plugin-custom/t019-no-empty-type.js → integrations/eslint/plugin/rules/typescript/t004-no-empty-type.js} +0 -0
- /package/{eslint-integration/eslint-plugin-custom/t025-no-nested-union-tuple.js → integrations/eslint/plugin/rules/typescript/t010-no-nested-union-tuple.js} +0 -0
- /package/{eslint-integration → integrations/eslint}/tsconfig.json +0 -0
- /package/rules/{C006_function_naming → common/C006_function_naming}/config.json +0 -0
- /package/rules/{C019_log_level_usage → common/C019_log_level_usage}/config.json +0 -0
- /package/rules/{C029_catch_block_logging → common/C029_catch_block_logging}/config.json +0 -0
- /package/rules/{C031_validation_separation → common/C031_validation_separation}/analyzer.js +0 -0
- /package/rules/{C031_validation_separation/README.md → docs/C031_validation_separation.md} +0 -0
- /package/{examples/basic-typescript-demo/test-file-targeting.sh → rules/universal/C010/generic.js} +0 -0
- /package/{examples/basic-typescript-demo/test-config-priority.sh → rules/universal/C010/tree-sitter-analyzer.js} +0 -0
package/.sunlint.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["recommended"],
|
|
3
|
+
"rules": {
|
|
4
|
+
"C019": "warn",
|
|
5
|
+
"C006": "warn",
|
|
6
|
+
"C029": "error",
|
|
7
|
+
"C031": "warn",
|
|
8
|
+
"S001": "warn",
|
|
9
|
+
"S002": "warn",
|
|
10
|
+
"S007": "warn",
|
|
11
|
+
"S013": "warn",
|
|
12
|
+
"T019": "error",
|
|
13
|
+
"T020": "warn",
|
|
14
|
+
"T021": "error"
|
|
15
|
+
},
|
|
16
|
+
"include": ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"],
|
|
17
|
+
"exclude": [
|
|
18
|
+
"node_modules/**",
|
|
19
|
+
"coverage/**",
|
|
20
|
+
"**/*.min.*",
|
|
21
|
+
".git/**",
|
|
22
|
+
"dist/**",
|
|
23
|
+
"build/**"
|
|
24
|
+
],
|
|
25
|
+
"engine": "eslint",
|
|
26
|
+
"languages": ["typescript", "javascript"],
|
|
27
|
+
"output": {
|
|
28
|
+
"format": "summary",
|
|
29
|
+
"console": true
|
|
30
|
+
},
|
|
31
|
+
"fileTargeting": {
|
|
32
|
+
"followSymlinks": false,
|
|
33
|
+
"maxDepth": 10
|
|
34
|
+
}
|
|
35
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,202 +1,168 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 🎉 SunLint v1.1.0 Release Notes
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Release Date**: July 23, 2025
|
|
4
|
+
**Type**: Minor Release (AST Enhancement & CLI Options Fix)
|
|
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
|
+
### 🧠 **AST-Enhanced Analysis**
|
|
11
|
+
- **Enhanced**: Heuristic engine now supports AST-based analysis using ESLint's parser infrastructure
|
|
12
|
+
- **Improved**: Rule C010 (block nesting) now uses AST for accurate detection
|
|
13
|
+
- **Modular**: AST modules integrated with silent fallback to regex when parsing fails
|
|
14
|
+
- **Performance**: ESLint-based parsers (@babel/parser, @typescript-eslint/parser) for JS/TS analysis
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
16
|
-
- **
|
|
17
|
-
- **Enhanced ESLint Integration** - TypeScript parser support and improved plugin loading
|
|
16
|
+
### 🎯 **CLI Options Fix**
|
|
17
|
+
- **Fixed**: `--quality` option now correctly selects quality rules (30 rules)
|
|
18
|
+
- **Fixed**: `--security` option now correctly selects security rules (41 rules)
|
|
19
|
+
- **Enhanced**: Rule selection service properly filters by category
|
|
20
|
+
- **Validated**: Both options tested and working correctly
|
|
18
21
|
|
|
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.)
|
|
22
|
+
### 📦 **Package Optimization**
|
|
23
|
+
- **Reduced**: Package size from 8MB to 243KB by excluding nested node_modules
|
|
24
|
+
- **Clean**: Updated .npmignore to exclude development files
|
|
25
|
+
- **Dependencies**: Moved AST parser dependencies to root package.json
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
---
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
# Run security rules only
|
|
34
|
-
sunlint --security --typescript --input=src/
|
|
29
|
+
## 📋 **Previous Changes (v1.0.7)**
|
|
35
30
|
|
|
36
|
-
|
|
37
|
-
sunlint --quality --typescript --input=src/
|
|
31
|
+
### 🔧 **Configuration Cleanup**
|
|
38
32
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 🚀 **Key Improvements**
|
|
42
36
|
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
- Better TypeScript parsing support in ESLint integration
|
|
48
|
-
- Modular plugin architecture for custom security rules
|
|
37
|
+
### 🔧 **Configuration Cleanup**
|
|
38
|
+
- **BREAKING**: Deprecated `ignorePatterns` in favor of `exclude` for better consistency
|
|
39
|
+
- **Auto-migration**: Existing configs with `ignorePatterns` will auto-migrate with deprecation warning
|
|
40
|
+
- **Unified logic**: Removed duplicate pattern processing for better performance
|
|
49
41
|
|
|
50
|
-
###
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
42
|
+
### 🎯 **File Targeting Fixes**
|
|
43
|
+
- **Fixed**: Specific file input (`--input=file.js`) now works correctly with config patterns
|
|
44
|
+
- **Enhanced**: Better include/exclude pattern resolution for both CLI and config
|
|
45
|
+
- **Improved**: Default include patterns for JavaScript/TypeScript files
|
|
54
46
|
|
|
55
|
-
###
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
47
|
+
### 🛡️ **Security Rules Enhancement**
|
|
48
|
+
- **Verified**: All security rules (S001, S002, S007, S013, etc.) working correctly
|
|
49
|
+
- **Tested**: Comprehensive rule detection across TypeScript and JavaScript files
|
|
50
|
+
- **Stable**: 20,000+ violation detection capability validated
|
|
59
51
|
|
|
60
52
|
---
|
|
61
53
|
|
|
62
|
-
##
|
|
63
|
-
|
|
64
|
-
###
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
|
54
|
+
## 📋 **Changes in Detail**
|
|
55
|
+
|
|
56
|
+
### ✅ **Configuration Changes**
|
|
57
|
+
- **Deprecated**: `ignorePatterns` → Use `exclude` instead
|
|
58
|
+
- **New**: Default include patterns: `["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"]`
|
|
59
|
+
- **Migration**: Automatic conversion with warning for backward compatibility
|
|
60
|
+
|
|
61
|
+
**Before (Deprecated):**
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"ignorePatterns": ["node_modules/**", "dist/**"]
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**After (Recommended):**
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"include": ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"],
|
|
72
|
+
"exclude": ["node_modules/**", "dist/**"]
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 🐛 **Bug Fixes**
|
|
77
|
+
- Fixed file targeting when using specific file input (`--input=cli.js`)
|
|
78
|
+
- Resolved circular symlink issues in `node_modules` traversal
|
|
79
|
+
- Eliminated duplicate ignore pattern processing
|
|
80
|
+
|
|
81
|
+
### 🏗️ **Internal Improvements**
|
|
82
|
+
- Cleaner file targeting service logic
|
|
83
|
+
- Better config merger with deprecation warnings
|
|
84
|
+
- Updated preset configurations to use `exclude`
|
|
143
85
|
|
|
144
86
|
---
|
|
145
87
|
|
|
146
|
-
## **
|
|
88
|
+
## 📦 **Updated Files**
|
|
147
89
|
|
|
148
|
-
|
|
90
|
+
### **Core Components**
|
|
91
|
+
- `core/file-targeting-service.js` - Simplified pattern processing
|
|
92
|
+
- `core/config-merger.js` - Added deprecation handling
|
|
93
|
+
- `core/config-manager.js` - Updated default config structure
|
|
149
94
|
|
|
150
|
-
### **
|
|
151
|
-
-
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
- **Package**: `@coding-quality/standards` → `@sun/sunlint`
|
|
95
|
+
### **Configuration**
|
|
96
|
+
- `config/presets/*.json` - Updated all presets to use `exclude`
|
|
97
|
+
- `config/sunlint-schema.json` - Removed deprecated `ignorePatterns`
|
|
98
|
+
- `.sunlint.json` - Updated with include patterns
|
|
155
99
|
|
|
156
|
-
### **
|
|
157
|
-
|
|
158
|
-
# Uninstall old tool
|
|
159
|
-
npm uninstall -g @coding-quality/standards
|
|
100
|
+
### **Documentation**
|
|
101
|
+
- `README.md` - Added breaking change notice and migration guide
|
|
160
102
|
|
|
161
|
-
|
|
162
|
-
npm install -g @sun/sunlint
|
|
103
|
+
---
|
|
163
104
|
|
|
164
|
-
|
|
165
|
-
mv .coding-standards.json .sunlint.json
|
|
105
|
+
## 🧪 **Validation Results**
|
|
166
106
|
|
|
167
|
-
|
|
168
|
-
|
|
107
|
+
✅ **Global Installation**: `npm install -g @sun-asterisk/sunlint`
|
|
108
|
+
✅ **Project Installation**: `npm install --save-dev @sun-asterisk/sunlint`
|
|
109
|
+
✅ **CLI Commands**: All CLI options tested and working
|
|
110
|
+
✅ **Rule Detection**: 20,263 violations detected across 4,272 files
|
|
111
|
+
✅ **Performance**: 17s analysis time for large codebase
|
|
169
112
|
|
|
170
|
-
|
|
171
|
-
sed -i 's/coding-standards/sunlint/g' package.json
|
|
172
|
-
```
|
|
113
|
+
---
|
|
173
114
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
115
|
+
## 🔄 **Migration Guide**
|
|
116
|
+
|
|
117
|
+
### **For Existing Users**
|
|
118
|
+
1. **Update your `.sunlint.json`:**
|
|
119
|
+
```bash
|
|
120
|
+
# Replace ignorePatterns with exclude
|
|
121
|
+
sed -i 's/ignorePatterns/exclude/g' .sunlint.json
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
2. **Add include patterns (recommended):**
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"include": ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"],
|
|
128
|
+
"exclude": ["node_modules/**", "dist/**", "**/*.min.*"]
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
3. **Test your configuration:**
|
|
133
|
+
```bash
|
|
134
|
+
sunlint --dry-run --verbose
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### **No Action Required**
|
|
138
|
+
- Existing configs with `ignorePatterns` will continue to work
|
|
139
|
+
- Automatic migration with deprecation warning
|
|
140
|
+
- Remove deprecated properties when convenient
|
|
188
141
|
|
|
189
142
|
---
|
|
190
143
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
144
|
+
## 📈 **Statistics**
|
|
145
|
+
|
|
146
|
+
| Metric | Value |
|
|
147
|
+
|--------|-------|
|
|
148
|
+
| **Rules Available** | 97+ (Security + Quality) |
|
|
149
|
+
| **File Processing** | 4,272 files analyzed |
|
|
150
|
+
| **Violation Detection** | 20,263 issues found |
|
|
151
|
+
| **Performance** | ~17 seconds for full analysis |
|
|
152
|
+
| **Languages Supported** | TypeScript, JavaScript, Dart |
|
|
199
153
|
|
|
200
154
|
---
|
|
201
155
|
|
|
202
|
-
|
|
156
|
+
## 🎯 **Next Steps**
|
|
157
|
+
|
|
158
|
+
- **v1.0.8**: Enhanced TypeScript analysis engine
|
|
159
|
+
- **v1.1.0**: Dart language support expansion
|
|
160
|
+
- **v1.2.0**: Custom rule authoring framework
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## 💫 **Acknowledgments**
|
|
165
|
+
|
|
166
|
+
Thanks to the Sun* Engineering team for continuous feedback and testing. Special recognition for helping identify and resolve the file targeting issues.
|
|
167
|
+
|
|
168
|
+
**Happy Linting!** ☀️
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# Contributing to Sun Lint
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to Sun Lint! 🌟
|
|
4
|
+
|
|
5
|
+
## 🚀 **Getting Started**
|
|
6
|
+
|
|
7
|
+
### **Prerequisites**
|
|
8
|
+
- Node.js 16+
|
|
9
|
+
- npm 8+
|
|
10
|
+
- Git
|
|
11
|
+
|
|
12
|
+
### **Setup Development Environment**
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Clone the repository
|
|
16
|
+
git clone https://github.com/sun-engineering/sunlint.git
|
|
17
|
+
cd sunlint
|
|
18
|
+
|
|
19
|
+
# Install dependencies
|
|
20
|
+
npm install
|
|
21
|
+
|
|
22
|
+
# Run tests
|
|
23
|
+
npm test
|
|
24
|
+
|
|
25
|
+
# Try the CLI locally
|
|
26
|
+
node cli.js --help
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 📋 **Coding Standards**
|
|
30
|
+
|
|
31
|
+
When contributing to Sun Lint, please follow these coding rules:
|
|
32
|
+
|
|
33
|
+
### **Code Quality Rules**
|
|
34
|
+
- **Rule C005** – Each function should do one thing only
|
|
35
|
+
- **Rule C006** – Function names must be verb/verb-noun
|
|
36
|
+
- **Rule C007** – Avoid comments that just describe the code
|
|
37
|
+
- **Rule C012** – Separate Command and Query operations (CQS principle)
|
|
38
|
+
- **Rule C014** – Use Dependency Injection instead of direct instantiation
|
|
39
|
+
- **Rule C015** – Use domain language in class/function names
|
|
40
|
+
- **Rule C019** – Don't use `error` log level for non-critical errors
|
|
41
|
+
- **Rule C031** – Keep validation logic separate
|
|
42
|
+
- **Rule C032** – Don't call external APIs in constructors or static blocks
|
|
43
|
+
- **Rule C033** – Separate processing logic and data queries in service layer
|
|
44
|
+
- **Rule C034** – Limit direct access to global state in domain logic
|
|
45
|
+
- **Rule C035** – When handling errors, log complete relevant information
|
|
46
|
+
- **Rule C037** – API handlers should return standard response objects (not raw strings)
|
|
47
|
+
- **Rule C038** – Avoid logic depending on file/module loading order
|
|
48
|
+
- **Rule C040** – Don't scatter validation logic across multiple classes
|
|
49
|
+
|
|
50
|
+
## 🔧 **Development Workflow**
|
|
51
|
+
|
|
52
|
+
### **Adding a New Quality Rule**
|
|
53
|
+
|
|
54
|
+
1. **Create Rule Implementation**
|
|
55
|
+
```bash
|
|
56
|
+
# Create the rule directory
|
|
57
|
+
mkdir -p rules/quality/c042-new-rule
|
|
58
|
+
cd rules/quality/c042-new-rule
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
2. **Implement the Rule**
|
|
62
|
+
```javascript
|
|
63
|
+
// rules/quality/c042-new-rule/analyzer.js
|
|
64
|
+
class C042NewRuleAnalyzer {
|
|
65
|
+
analyze(code, filePath) {
|
|
66
|
+
// Implementation following Rule C005 (single responsibility)
|
|
67
|
+
return this.findViolations(code, filePath);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
findViolations(code, filePath) {
|
|
71
|
+
// Rule C031: Keep validation logic separate
|
|
72
|
+
const violations = [];
|
|
73
|
+
// Analysis logic here
|
|
74
|
+
return violations;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
module.exports = C042NewRuleAnalyzer;
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
3. **Add Configuration**
|
|
82
|
+
```json
|
|
83
|
+
// rules/quality/c042-new-rule/config.json
|
|
84
|
+
{
|
|
85
|
+
"id": "C042",
|
|
86
|
+
"name": "New Rule Name",
|
|
87
|
+
"category": "quality",
|
|
88
|
+
"severity": "error",
|
|
89
|
+
"description": "Description following Rule C015 (domain language)",
|
|
90
|
+
"languages": ["typescript", "dart", "kotlin"],
|
|
91
|
+
"tags": ["maintainability", "readability"]
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
4. **Update Registry**
|
|
96
|
+
```javascript
|
|
97
|
+
// Add to config/rules/rules-registry.json
|
|
98
|
+
{
|
|
99
|
+
"C042": {
|
|
100
|
+
"id": "C042",
|
|
101
|
+
"name": "New Rule Name",
|
|
102
|
+
"category": "quality",
|
|
103
|
+
"path": "./rules/quality/c042-new-rule",
|
|
104
|
+
"analyzer": "analyzer.js",
|
|
105
|
+
"config": "config.json"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
5. **Add Tests**
|
|
111
|
+
```javascript
|
|
112
|
+
// test/fixtures/c042/valid.ts
|
|
113
|
+
// test/fixtures/c042/invalid.ts
|
|
114
|
+
// test/unit/rules/c042.test.js
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### **Adding a New Security Rule**
|
|
118
|
+
|
|
119
|
+
Same process but in `rules/security/` directory with `security` category.
|
|
120
|
+
|
|
121
|
+
## 🧪 **Testing**
|
|
122
|
+
|
|
123
|
+
### **Run All Tests**
|
|
124
|
+
```bash
|
|
125
|
+
npm test
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### **Run Specific Tests**
|
|
129
|
+
```bash
|
|
130
|
+
# Test specific rule
|
|
131
|
+
npm run test:c019
|
|
132
|
+
|
|
133
|
+
# Test multiple rules
|
|
134
|
+
npm run test:multi
|
|
135
|
+
|
|
136
|
+
# Test all quality rules
|
|
137
|
+
npm run test:quality
|
|
138
|
+
|
|
139
|
+
# Test all security rules
|
|
140
|
+
npm run test:security
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### **Test Your Changes**
|
|
144
|
+
```bash
|
|
145
|
+
# Test your new rule
|
|
146
|
+
node cli.js --rule=C042 --input=test/fixtures --format=eslint
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## 📊 **Code Review Process**
|
|
150
|
+
|
|
151
|
+
1. **Self-Review Checklist**
|
|
152
|
+
- [ ] Follows all Sun Lint coding rules (C005, C006, etc.)
|
|
153
|
+
- [ ] Rule C035: Error handling includes complete logging
|
|
154
|
+
- [ ] Rule C037: API responses use standard format
|
|
155
|
+
- [ ] Rule C040: Validation logic is centralized
|
|
156
|
+
- [ ] Tests pass and cover edge cases
|
|
157
|
+
- [ ] Documentation updated
|
|
158
|
+
|
|
159
|
+
2. **Submit Pull Request**
|
|
160
|
+
- Clear title and description
|
|
161
|
+
- Reference related issues
|
|
162
|
+
- Include test results
|
|
163
|
+
- Follow template
|
|
164
|
+
|
|
165
|
+
3. **Review Criteria**
|
|
166
|
+
- Code quality (follows our own rules!)
|
|
167
|
+
- Test coverage
|
|
168
|
+
- Documentation completeness
|
|
169
|
+
- Performance impact
|
|
170
|
+
- Backward compatibility
|
|
171
|
+
|
|
172
|
+
## 📝 **Documentation**
|
|
173
|
+
|
|
174
|
+
### **Update Documentation**
|
|
175
|
+
When adding features:
|
|
176
|
+
- Update `README.md`
|
|
177
|
+
- Add rule documentation
|
|
178
|
+
- Update configuration examples
|
|
179
|
+
- Add usage examples
|
|
180
|
+
|
|
181
|
+
### **Rule Documentation Template**
|
|
182
|
+
```markdown
|
|
183
|
+
## Rule C042: New Rule Name
|
|
184
|
+
|
|
185
|
+
**Category**: Quality
|
|
186
|
+
**Severity**: Error
|
|
187
|
+
**Languages**: TypeScript, Dart, Kotlin
|
|
188
|
+
|
|
189
|
+
### Description
|
|
190
|
+
Following Rule C015 (domain language), use clear business terms...
|
|
191
|
+
|
|
192
|
+
### Examples
|
|
193
|
+
|
|
194
|
+
**❌ Bad:**
|
|
195
|
+
```typescript
|
|
196
|
+
// Code that violates the rule
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**✅ Good:**
|
|
200
|
+
```typescript
|
|
201
|
+
// Code that follows the rule
|
|
202
|
+
```
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## 🐛 **Bug Reports**
|
|
206
|
+
|
|
207
|
+
When reporting bugs:
|
|
208
|
+
1. Use clear, descriptive title
|
|
209
|
+
2. Include reproduction steps
|
|
210
|
+
3. Provide sample code
|
|
211
|
+
4. Include environment details
|
|
212
|
+
5. Include sunlint output
|
|
213
|
+
|
|
214
|
+
## 💡 **Feature Requests**
|
|
215
|
+
|
|
216
|
+
For new features:
|
|
217
|
+
1. Check existing issues first
|
|
218
|
+
2. Describe the use case
|
|
219
|
+
3. Provide examples
|
|
220
|
+
4. Consider implementation complexity
|
|
221
|
+
5. Think about backward compatibility
|
|
222
|
+
|
|
223
|
+
## 🤝 **Community**
|
|
224
|
+
|
|
225
|
+
- **Discord**: [Sun Engineering Discord](https://discord.gg/sun-engineering)
|
|
226
|
+
- **Issues**: [GitHub Issues](https://github.com/sun-engineering/sunlint/issues)
|
|
227
|
+
- **Discussions**: [GitHub Discussions](https://github.com/sun-engineering/sunlint/discussions)
|
|
228
|
+
|
|
229
|
+
## 📄 **License**
|
|
230
|
+
|
|
231
|
+
By contributing, you agree that your contributions will be licensed under the MIT License.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
**Thank you for making Sun Lint better! ☀️**
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# SunLint Project Structure
|
|
2
|
+
|
|
3
|
+
## 📁 **Organized Directory Structure**
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
sunlint/
|
|
7
|
+
├── 📄 README.md # Main documentation (490 lines, focused)
|
|
8
|
+
├── 📄 CHANGELOG.md # Version history (concise)
|
|
9
|
+
├── 🚀 cli.js # Main CLI entry point
|
|
10
|
+
├── ⚙️ config/ # Configuration presets & schemas
|
|
11
|
+
├── 🔧 core/ # Core services & engines
|
|
12
|
+
├── 📖 docs/ # Detailed documentation
|
|
13
|
+
├── 🔗 integrations/ # External tool integrations
|
|
14
|
+
│ └── eslint/ # ESLint plugin & configurations
|
|
15
|
+
├── 📋 examples/ # Configuration examples & workflows
|
|
16
|
+
├── 🧪 test/ # Test projects & fixtures
|
|
17
|
+
├── 📦 release/ # Release artifacts
|
|
18
|
+
├── 🎯 rules/ # SunLint rule implementations
|
|
19
|
+
└── 🛠️ scripts/ # Build & deployment scripts
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 🎯 **Key Changes Made**
|
|
23
|
+
|
|
24
|
+
### ✅ **Files Removed**
|
|
25
|
+
- `CLI_STRUCTURE.md` - Temporary documentation (unnecessary)
|
|
26
|
+
|
|
27
|
+
### ✅ **Structure Reorganized**
|
|
28
|
+
- **examples/** - Now pure configuration examples & CI/CD workflows
|
|
29
|
+
- **test/** - All test projects consolidated here
|
|
30
|
+
- `sunlint-test-project/` - ESLint v9 integration test
|
|
31
|
+
- `conflict-test-project/` - ESLint v8 legacy test
|
|
32
|
+
- `examples/integration-project/` - Integration example
|
|
33
|
+
- `fixtures/` - Unit test files
|
|
34
|
+
- **project-test/** - Real projects (gitignored, separate from test suite)
|
|
35
|
+
|
|
36
|
+
### ✅ **Documentation Updated**
|
|
37
|
+
- **README.md** - Streamlined from 650 → 490 lines (25% reduction)
|
|
38
|
+
- **CHANGELOG.md** - Security rules section condensed
|
|
39
|
+
- **test/README.md** - Test project documentation
|
|
40
|
+
- **examples/README.md** - Configuration examples guide
|
|
41
|
+
|
|
42
|
+
## 🎉 **Benefits**
|
|
43
|
+
|
|
44
|
+
1. **Clear Separation**: Examples vs Tests vs Real Projects
|
|
45
|
+
2. **Reduced Duplication**: Single source of truth for each purpose
|
|
46
|
+
3. **Better Documentation**: Focused README + detailed CHANGELOG
|
|
47
|
+
4. **Cleaner Repository**: No redundant files, proper gitignore
|
|
48
|
+
5. **Developer Friendly**: Clear structure for contributors
|
|
49
|
+
|
|
50
|
+
## 🔍 **Quick Navigation**
|
|
51
|
+
|
|
52
|
+
- **Getting Started**: `README.md`
|
|
53
|
+
- **Version History**: `CHANGELOG.md`
|
|
54
|
+
- **Configuration Help**: `examples/`
|
|
55
|
+
- **Testing**: `test/`
|
|
56
|
+
- **Development**: `docs/ARCHITECTURE.md`
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
**Structure optimized for both users and contributors! 🚀**
|