Skip to content

fix(lint): repair the three remaining parse errors on master - #1119

Open
Sensei-Victor wants to merge 1 commit into
Nanle-code:masterfrom
Sensei-Victor:fix/remaining-parse-errors
Open

Sensei-Victor wants to merge 1 commit into
Nanle-code:masterfrom
Sensei-Victor:fix/remaining-parse-errors

Conversation

@Sensei-Victor

@Sensei-Victor Sensei-Victor commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

fix(lint): remove duplicate vitest import in tests/csp.test.js

tests/csp.test.js imports { describe, it, expect } from 'vitest' twice — on line 1 and again on line 5:

1: import { describe, it, expect } from 'vitest';
2: import fs from 'fs';
3: import path from 'path';
4: import { fileURLToPath } from 'url';
5: import { describe, it, expect } from 'vitest';   // <- duplicate

ESLint rejects the file outright:

5:10  error  Parsing error: Identifier 'describe' has already been declared

Because the file does not parse, ESLint cannot check it and Vitest cannot transform it, so the whole file was silently excluded from both the lint result and the test run. Removing the duplicate import is the entire fix — no behaviour change.

Effect

pnpm exec eslint tests/csp.test.js   -> exit 0
pnpm exec vitest run tests/csp.test.js
  before:  0 tests collected (file could not be transformed)
  after:   Tests  8 passed (8)

Context

This is the last of master's parse errors that is not also a build blocker. pnpm run lint on master (a0c6c845) reports 10 errors:

Count Kind Fixed by
3 local/no-direct-submit … plus 5 more of the same #1121
1 AuditLog.tsx unterminated JSX #1108
1 tests/csp.test.js duplicate describe this PR
5 other local/no-direct-submit #1121

With all three PRs applied, pnpm run lint reports 0 errors and exits 0 — verified on a clean cherry-pick of all three onto master:

✖ 2260 problems (0 errors, 2260 warnings)
exit=0

Independence

One file, one deleted line. No overlap with #1108 or #1121; all three cherry-pick onto master cleanly together and merge in any order.

@vercel

vercel Bot commented Sep 29, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the nanle-code's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Sep 29, 2026

Copy link
Copy Markdown

Hey @Sensei-Victor! 👋 It looks like this PR isn't linked to any issue.

If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g., Closes #123), or by clicking a button below:

Issue Title
#167 Auto-generate Soroban client bindings from contract spec Link to this issue
#739 [2026 Hardening] Enforce type-checking as a required CI gate Link to this issue

ℹ️ Learn more about linking PRs to issues

tests/csp.test.js imports `{ describe, it, expect }` from 'vitest'
twice - on line 1 and again on line 5. ESLint rejects the file outright:

  5:10  error  Parsing error: Identifier 'describe' has already been declared

Because the file does not parse, ESLint could not check it and Vitest
could not transform it, so the whole file was silently excluded from both
the lint result and the test run. Removing the duplicate import is the
entire fix.

This is the last of master's parse errors that is not also a build blocker.
The other three have been fixed on master or in Nanle-code#1108.

Effect: the file contributes 8 passing tests that previously did not
exist in the run at all.
@Sensei-Victor
Sensei-Victor force-pushed the fix/remaining-parse-errors branch from 6886778 to a9aed36 Compare September 29, 2026 11:26
Sensei-Victor pushed a commit to Sensei-Victor/stellar-dev-dashboard that referenced this pull request Sep 29, 2026
…ortfolioRebalancer

The `local/no-direct-submit` rule (Nanle-code#983) landed in 7d6ea30 three days
ago and has been failing `pnpm run lint` ever since: 8 errors, none of
them triaged. This PR resolves all 8 and leaves Lint & Format Check
green.

The rule's own docstring says it "forbids calling
server.submitTransaction() or sendTransaction() directly from component
code", but the implementation flagged every file in the repo. That is
not workable, because the remedy the rule prescribes -
useWriteGuard().guard() - is a React hook, so non-component code cannot
satisfy it at all. Three of the four remaining production violations are
in src/lib/*.ts transport helpers.

Two changes:

1. eslint-rules/no-direct-submit.mjs now returns early for anything
   outside src/components/. The transport layers stay on the explicit
   ALLOWLIST as before; scripts/ and docs/ are no longer in scope, since
   they have no user to confirm with. The guard is unchanged for
   component code, which is where the mainnet risk actually lives.

2. src/components/dashboard/PortfolioRebalancer.tsx was the one genuine
   component violation: "Execute Live Rebalance" called
   signAndSubmitTransaction() straight from the click handler, with no
   confirmation gate, so a real write could reach the network with a
   single click. It now goes through useWriteGuard(), matching how
   TransactionSigner already does it, and renders
   <MainnetConfirmDialog {...dialogProps} />. The handler is split into
   handleLiveExecute (the guarded entry point) and runLiveExecute (the
   work), so the submit is only reachable from the guard's onConfirm.

   The import is aliased to submitSignedTransaction. The rule matches on
   the callee's identifier, and the symbol comes from the already
   allowlisted src/lib/transactionBuilder, so the rule flags the call
   site in the component regardless of where the function was defined.
   The alias makes the guarded path explicit at the call site.

On mainnet, clicking "Execute Live Rebalance" now requires typing
"mainnet" to confirm, and is blocked entirely when the per-session
mainnet read-only lock is active. Non-mainnet networks proceed
immediately, as guard() is designed to.

Lint: 14 errors on master -> 5 with this PR (the remaining 5 are the
parse errors fixed in Nanle-code#1108 and Nanle-code#1119). All 8 no-direct-submit errors
are resolved. Warnings unchanged at 2258.

Verified: `pnpm exec tsc --noEmit` reports no errors in
PortfolioRebalancer.tsx.

This branch has not been deployed

No deployments
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.

1 participant