Skip to content

chore: add eslint, clear its findings, and stop a test writing a debug artifact - #57

Merged
khusseini merged 2 commits into
developfrom
chore/lint-and-housekeeping
Aug 3, 2026
Merged

chore: add eslint, clear its findings, and stop a test writing a debug artifact#57
khusseini merged 2 commits into
developfrom
chore/lint-and-housekeeping

Conversation

@khusseini

Copy link
Copy Markdown
Contributor

Closes the remaining findings from the repository health review.

1. Add a linter (c76f2b6)

The project had no linter of any kind — no eslint/prettier/biome config, no lint script — despite CONTRIBUTING.md:131 and agents.md:148 both instructing contributors to "follow the existing code style". Nothing mechanical enforced it across 22 SFCs and 50 TS files.

Adds ESLint 9 flat config with eslint-plugin-vue, typescript-eslint and @vue/eslint-config-typescript, plus lint / lint:fix scripts and a Lint step in CI ahead of typecheck.

Retrofitting a linter surfaces a backlog, so severities are deliberate rather than default:

  • npm run lint runs with --max-warnings 268 — the current count. Warnings stay visible and cannot grow, but don't block today.
  • Errors are at zero, so CI blocks on any new error immediately.
  • no-explicit-any is a warning: the resolver/schema seams intentionally use any where FormKit's own types bottom out.

2. Clear the findings (6bb2eb1)

  • Removed 13 unused imports and 14 unused bindings across src and tests.
  • Replaced four bare //@ts-ignore with //@ts-expect-error plus a description. All four still suppress a real error — confirmed, since ts-expect-error itself fails when there's nothing to suppress.
  • Rewrote a && short-circuit used as a statement as an if.
  • Template reformatting: vue/recommended includes formatting rules, so the SFCs got reflowed (attribute wrapping, indentation). This is the bulk of the diff and is presentational only.

3. The hello.txt mystery, solved

hello.txt had a permanent .gitignore entry. The cause was a leftover debug line in a test:

// tests/components/CraftStaticRenderer.spec.ts:216
writeFileSync("hello.txt", wrapper.html());

Every test run — including every CI run — was writing a file into the repo root. Removed the line, its fs import, the .gitignore entry, and the artifact.

⚠️ Four pre-existing defects found — NOT fixed here

The linter surfaced four genuine bugs. Fixing them changes runtime behaviour, which doesn't belong in a "add a linter" PR, so each is a warning annotated with its site in eslint.config.js, pending triage:

Rule Site What's wrong
vue/no-dupe-keys CraftIframe.vue:84 A prop inheritStyles and a function const inheritStyles share one name — they collide in template scope
vue/no-mutating-props CraftNodeStatic.vue:145 setNodeRuntimeProps writes directly into the nodeRuntimeProps prop object
vue/require-v-for-key CraftEditorBlueprintsList.vue:3 v-for over blueprints.groups with no :key
vue/no-use-v-if-with-v-for CraftFrame.vue:16,22,30,36 v-if on the same element as v-for

Promote these back to error once fixed.

Verification

  • npm run lint — exit 0
  • npm run typecheck — exit 0
  • npm run build — exit 0
  • npm test — 180/180 passing

🤖 Generated with Claude Code

khusseini and others added 2 commits August 1, 2026 17:01
…I on it

The project had no linter of any kind — no eslint/prettier/biome config and
no lint script — despite CONTRIBUTING.md and agents.md both telling
contributors to "follow the existing code style". Nothing mechanical
enforced that.

Adds ESLint 9 (flat config) with eslint-plugin-vue, typescript-eslint and
@vue/eslint-config-typescript, plus `lint` / `lint:fix` scripts and a Lint
step in CI ahead of typecheck.

Retrofitting a linter onto an existing codebase surfaces a backlog, so the
severities are deliberate rather than default:

- `lint` runs with `--max-warnings 268`, the current count. Warnings are
  visible and cannot grow, but do not block today.
- Four vue rules flag genuine pre-existing defects whose fixes would change
  runtime behaviour, so they are warnings pending triage, each annotated in
  the config with its site: vue/require-v-for-key,
  vue/no-use-v-if-with-v-for, vue/no-dupe-keys and vue/no-mutating-props.
- no-explicit-any is a warning; the resolver/schema seams intentionally use
  `any` where FormKit's own types bottom out.

Errors are at zero, so CI blocks on any new error from day one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Applies `eslint --fix` and clears every remaining error so CI can gate on
errors from day one.

- Removes 13 unused imports and 14 unused bindings across src and tests.
- `vue/recommended` includes template formatting rules, so the SFCs are
  reformatted (attribute wrapping and indentation). Presentational only.
- Replaces four bare `//@ts-ignore` with `//@ts-expect-error` plus a
  description of why the suppression is needed. All four still suppress a
  real error, confirmed by vue-tsc.
- Rewrites a `&&` short-circuit used as a statement as an `if` in
  demo-content.ts.

Also removes a leftover `writeFileSync("hello.txt", wrapper.html())` debug
line from CraftStaticRenderer.spec.ts. Every test run was dropping a
hello.txt in the repo root, which is why the file had earned a permanent
.gitignore entry — that entry is now removed too, along with the artifact.

Verified: lint, typecheck and build all exit 0; 180/180 tests pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Files with missing lines Coverage Δ
src/components/CraftCanvas.vue 100.00% <100.00%> (ø)
src/components/CraftComponentSimpleText.vue 53.01% <100.00%> (ø)
src/components/CraftEditor.vue 83.78% <100.00%> (ø)
src/components/CraftEditorBlueprint.vue 100.00% <100.00%> (ø)
src/components/CraftEditorBlueprintsList.vue 100.00% <100.00%> (ø)
src/components/CraftEditorPanelBlueprints.vue 100.00% <100.00%> (ø)
src/components/CraftEditorPanelForm.vue 100.00% <100.00%> (ø)
src/components/CraftEditorPanelLayers.vue 100.00% <100.00%> (ø)
src/components/CraftEditorPanelLayout.vue 100.00% <100.00%> (ø)
...ponents/CraftEditorPanelNodeDataSourceSettings.vue 100.00% <100.00%> (ø)
... and 17 more
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@khusseini
khusseini merged commit d9769fe into develop Aug 3, 2026
6 checks passed
@khusseini
khusseini deleted the chore/lint-and-housekeeping branch August 3, 2026 22:11
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.1.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant