ENG-1832 Add Obsidian eslint to the project - #1328
Open
trangdoan982 wants to merge 1 commit into
Open
Conversation
Add eslint-plugin-obsidianmd as a dedicated store-compliance gate that reports only the rules which can get the plugin pulled from the Obsidian community store, and fix the 15 violations it found. The gate cannot be built on @repo/eslint-config: that config loads eslint-plugin-only-warn, which patches ESLint globally on import and forces every rule to "warn", erasing the error/warn distinction the gate depends on. It therefore lives in its own config and runs in its own process. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
Contributor
PR size/scope checkThis PR is over our review-size guideline.
Please split this into smaller PRs unless there is a clear reason the changes need to land together. If keeping it as one PR, please add a brief justification covering:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
eslint-plugin-obsidianmdcatches the plugin-guideline violations that get plugins rejected from the Obsidian community store, but wiring it in naively drowns the signal: its recommended set reports 168 new findings inapps/obsidian, of which only a handful can actually cost us the store listing. This adds a dedicated gate that reports only store blockers, and fixes the 15 real violations so the gate can be blocking from day one.Replaces the closed #1188, which was blocked on ESLint 8. That's moot now — the repo is on ESLint 9.39.5 and typescript-eslint 8.67.0, so the plugin's peers are satisfied with no catalog scoping.
Review focus
packages/eslint-config/obsidian-store.js— the gate. Keeps only obsidianmd's own error-level rules and drops everything its recommended set drags in (eslint-comments,depend,import,security,sdl), which contributed 43 findings + 8 unused-directive errors unrelated to store review.apps/obsidian/src/components/canvas/DiscourseToolPanel.tsx— the riskiest change. The drag ghost's 11 inline style writes became two class constants. Note theclassNameon the JSX must stay a constant expression; the reactor writes it imperatively and React only clobbers props whose rendered value changed..github/workflows/ci.yaml— new job is blocking. Intentional, but it's a new way for PRs to go red.Decisions worth challenging
@repo/eslint-config. That config loadseslint-plugin-only-warn, which patches ESLint globally on import and forces every rule to"warn"— the exact distinction this gate exists to make. I verified an explicit"error"severity does not override it. Hence a separate config in a separate process. The alternative — droppingonly-warnrepo-wide — would turn 112 existing Obsidian warnings and 538 Roam warnings into hard errors, so it was rejected as out of scope.packages/eslint-config, notapps/obsidian. It must register thepreferArrows/react-hooks/turbonamespaces, or existingeslint-disablecomments in our source raiseDefinition for rule ... was not found. That package already depends on all three;apps/obsidiandoes not.scripts/is exempt. All 22no-consoleerrors were in build and test-data tooling that never ships in the plugin bundle, so Obsidian never reviews it. Exempting it took the gate from 37 errors to 15, all in shipped code.prefer-window-timers,prefer-create-el,ui/sentence-case, …) are style advice, not store blockers. Deliberately deferred — 46 are auto-fixable and worth a follow-up ticket.styles.cssfor the fixes, per project UI guidelines. No new CSS was needed.pnpm lintis untouched.base.jsandreact-internal.jsare unmodified, so Roam and the website are unaffected.Verification
lint:storeexits 0. Negative test: addingel.style.color = "red"is caught as an error with exit 1 — confirming severity survives, which is the whole point of the separate config.check-typesexits 0;buildreports 0 errors.apps/obsidianlint unchanged at 112 messages / 0 errors, before and after.obsidianmd/*rules leaked.prettier --checkclean on all changed files.getComputedStyle. All 8 properties identical —display: flex,position: fixed,pointer-events: none,left: 0px,top: 0px,width: 50px,height: 50px,align-items: center— and.hiddenresolves todisplay: none. (First run showed 3 mismatches purely from stale plugin CSS; reloading the plugin resolved all 3.)Not covered: no unit tests — the change is lint config plus CSS-equivalent refactors, and the repo has no test setup for either. The drag-ghost interaction was verified by computed-style equivalence, not by performing an end-to-end drag on a canvas, so a manual drag is worth a reviewer's minute.
Known limits
eslint-plugin-obsidianmdupgrades worth reading closely.eslint-plugin-obsidianmdwants@eslint/js@^9.30.1whilepackages/eslint-configpins^9.29.0. Install succeeds and nothing misbehaves, so I left the pin alone rather than widen scope.🤖 Generated with Claude Code