Skip to content

Feature/475 eslint plugin - #541

Open
ajulaybeeb wants to merge 5 commits into
Stellar-Search:mainfrom
ajulaybeeb:feature/475-eslint-plugin
Open

Feature/475 eslint plugin#541
ajulaybeeb wants to merge 5 commits into
Stellar-Search:mainfrom
ajulaybeeb:feature/475-eslint-plugin

Conversation

@ajulaybeeb

Copy link
Copy Markdown

📌 Overview

Resolves #475.

This PR introduces eslint-plugin-greenpay, a bespoke ESLint plugin enforcing GreenPay's internal architectural invariants and preventing common bugs like precision loss on monetary variables. It also ships a baseline suppression engine to allow immediate adoption without needing a big-bang conversion of all existing legacy violations.

🔍 Technical Approach

  • Rule Construction: Built no-parsefloat-numeric (Money Rule), no-nested-envelope (Envelope Rule with auto-fix), no-cross-package-imports, and no-undeclared-reachable using ESLint AST visitors.
  • Baseline Engine: Added lib/utils/baseline.js which wraps context.report to gracefully squelch diagnostics for files mapped in .greenpay-eslint-baseline.json.
  • Testing: Includes a tests/index.test.js rule-testing harness proving out true-positives gathered from real commits and false-positive cases.
  • Integration: Plugs plugin:greenpay/recommended directly into the backend/ and frontend/ .eslintrc.json files.

🧪 Testing & Verification

  • node tests/index.test.js passes all rule unit tests.
  • Manually verified that existing parseFloat() sites inside the backend/ do not throw lint errors due to the active baseline suppression.

…ross-runtime validation, and custom linting

- Implemented Husky commit-msg and pre-push policy enforcer (Resolves Stellar-Search#476)
- Created scripts/check-invariants.js to run standalone tests on pre-commit (Resolves Stellar-Search#473)
- Scaffolded shared validation schema and replaced backend strkey regex (Resolves Stellar-Search#474)
- Scaffolded eslint-plugin-greenpay for internal rules (Resolves Stellar-Search#475)
- Authored scripts/engine/core.js to dynamically execute and aggregate invariant rules
- Implemented scripts/engine/baseline.js to support .invariant-baseline.json suppressions
- Created python-rule.js adapter to natively parse check-k8s-manifests.py JSON output
- Migrated check-invariants.js to act as the primary engine registry
- Created shared/validators/stellarValidator.js utilizing @stellar/stellar-sdk's StrKey
- Replaced vulnerable hand-rolled regexes in backend schemas, event sourcing, and routes
- Migrated extension session-state and frontend form UI to the SDK's CRC16 checksum check
- Resolves Stellar-Search#474
…nal invariants

- Implemented eslint-plugin-greenpay containing 4 internal AST rules
- Added 'no-parsefloat-numeric' to prevent precision loss on monetary types
- Added 'no-nested-envelope' to flag redundant res.data.data reads with auto-fixer
- Added 'no-cross-package-imports' to enforce backend/frontend/mobile architectural boundaries
- Added 'no-undeclared-reachable' check
- Implemented .greenpay-eslint-baseline.json to suppress existing violations and allow gradual rollout
- Resolves Stellar-Search#475
@ajulaybeeb
ajulaybeeb force-pushed the feature/475-eslint-plugin branch from b957e0d to 254e781 Compare August 28, 2026 12:00
@ajulaybeeb
ajulaybeeb force-pushed the feature/475-eslint-plugin branch from 0fac458 to c4dbffc Compare August 28, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cross-cutting: A lint rule pack for the bug classes this repository actually ships

2 participants