fix: resolve lint warnings (batch approach)#12478
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📦 Bundle Stats —
|
| Metric | Value | vs main (9e36cda) | vs v5.17.1 |
|---|---|---|---|
| Internal (raw) | 4.37 MB | +95 B, +0.0% | -33.0 KB, -0.7% |
| Internal (gzip) | 1.00 MB | +17 B, +0.0% | -8.8 KB, -0.9% |
| Bundled (raw) | 12.04 MB | +191 B, +0.0% | -69.6 KB, -0.6% |
| Bundled (gzip) | 2.71 MB | +22 B, +0.0% | -15.6 KB, -0.6% |
| Import time | 1.61s | +18ms, +1.1% | +97ms, +6.4% |
Details
- Import time regressions over 10% are flagged with
⚠️ - Treemap artifacts are attached to the CI run for detailed size analysis
- Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
🧪 E2E Preview environment🔑 Environment Variables for Local TestingThis is the preview URL for the E2E tests: https://e2e-studio-oh7au1f0n.sanity.dev To run the E2E tests locally, you can use the following environment variables, then run 💬 Remember to build the project first with |
📊 Playwright Test ReportThis report contains test results, including videos of failing tests. |
📚 TypeDoc Generation Result✅ TypeDoc generated successfully!
The TypeDoc JSON file has been generated and validated. All documentation scripts completed successfully. |
⚡️ Editor Performance ReportUpdated Tue, 24 Mar 2026 09:10:44 GMT
Detailed information🏠 Reference resultThe performance result of
🧪 Experiment resultThe performance result of this branch
📚 Glossary
|
| } | ||
|
|
||
| const result = render( | ||
| const view = render( |
There was a problem hiding this comment.
Fixes:
result is not a recommended name for render returned value. Instead, you should destructure it, or name it using one of: view, or utilseslinttesting-library/render-result-naming-convention
| { | ||
| getFullscreenPath: () => undefined, | ||
| setFullscreenPath: () => {}, | ||
| setFullscreenPath: () => { /* intentionally empty */ }, |
There was a problem hiding this comment.
Fixes
Unexpected empty arrow function.eslintno-empty-function
There was a problem hiding this comment.
I wonder if it would be preferrable in these cases to simply add a lint ignore? 🤔
Add `/* intentionally empty */` comments to 45 empty function bodies across 33 files to satisfy the no-empty-function ESLint rule. No functional changes. Co-authored-by: luke <luke@miriad.systems>
…nt warnings - Rename render result variables to `view` per testing-library convention (33 warnings across 12 files: result, rendered, value, html, component, ret → view) - Replace parameter reassignment with local variables (4 warnings across 3 files) No functional changes. Co-authored-by: luke <luke@miriad.systems>
Co-authored-by: luke <luke@miriad.systems>
- StringInputBasic.test.tsx: Replace container.querySelector('input') with screen.getByRole('textbox')
- ReleaseDetail.test.tsx: Remove .closest('button') calls on publish-all-button testid
- ReleaseDocumentPreview.test.tsx: Replace container.querySelector('a') with screen.getByRole('link'), add data-testid to mock
- IntentLink.test.tsx: Replace container.querySelector('a')?.href with screen.getByRole('link') + toHaveAttribute
- StringInputPortableText.test.tsx: Replace container.querySelector with screen.getByTestId
- DialogTimeZone.test.tsx: Replace parentElement traversal with direct screen.getByRole query
- useScheduledDraftMenuActions.test.tsx: Replace .children access with within().getAllByRole('menuitem')
- ColumnsControl.test.tsx: Replace document.querySelector('[role="menu"]') with screen.getByRole('menu')
- ReleaseTypePicker.test.tsx: Replace .closest('[role="tab"]') with screen.getByRole('tab', {name})
- ReleaseDashboardFooter.test.tsx: Minor cleanup (rule not active in flat config)
- CreateReleaseDialog.test.tsx: Remove .closest('button') on submit button
Co-authored-by: luke <luke@miriad.systems>
…rnings)
Replace direct DOM access patterns with testing-library queries:
- container.querySelector() → screen.getByRole/getByTestId/getByText
- .closest('button') → screen.getByRole('button', { name })
- document.querySelector() → screen.getByTestId/getByRole
- document.activeElement checks → toHaveFocus() matcher
- .firstChild/.children/.parentNode → within().getBy* queries
Add eslint-disable for legitimate cases with no testing-library equivalent:
- Hidden file inputs (no accessible role)
- SVG elements (no accessible role)
- React class component this.props.children (false positive)
- Structural child count assertions
No functional changes — all tests preserve their original semantics.
Co-authored-by: luke <luke@miriad.systems>
- prefer-query-by-disappearance: use queryBy* instead of getBy* in waitForElementToBeRemoved() callbacks (4 warnings) - no-render-in-lifecycle: move render() from beforeEach into individual test blocks (1 warning) - no-container: add eslint-disable for SVG with no accessible role (1 warning) No functional changes. Co-authored-by: luke <luke@miriad.systems>
…ty */
Per code review feedback, replace `/* intentionally empty */` comments
inside empty function bodies with `// eslint-disable-next-line no-empty-function`
comments and collapse back to empty `() => {}` bodies.
This is cleaner — it explicitly suppresses the lint rule rather than
working around it with a placeholder comment.
Co-authored-by: luke <luke@miriad.systems>
ec5e1bc to
a431bfa
Compare
Summary
This PR systematically fixes ESLint lint warnings across the monorepo.
Result: 330 → 18 warnings (312 fixed, 95% reduction, 0 errors)
Batch 1:
no-empty-function(45 warnings → 0) ✅// eslint-disable-next-line no-empty-functionto suppress warnings on intentionally empty function bodies across 33 filesBatch 2:
render-result-naming-convention+no-param-reassign(37 warnings → 0) ✅viewper testing-library convention across 12 filesresult,rendered,value,html,component,ret→viewresolveDeep.test.ts:depthparam →currentDepthlocalpanels/util.ts:deltaparam →effectiveDeltalocaluseMainDocument.ts:routeparam →currentRoutelocalBatch 3:
testing-library/no-node-access(211 warnings → 0) ✅container.querySelector()→screen.getByRole/getByTestId/getByText.closest("button")→screen.getByRole("button", { name })document.querySelector()→screen.getByTestId/getByRoledocument.activeElementchecks →toHaveFocus()matcher.firstChild/.children/.parentNode→within().getBy*queriesBatch 4: Remaining testing-library rules (6 warnings → 0) ✅
prefer-query-by-disappearance: usequeryBy*instead ofgetBy*inwaitForElementToBeRemoved()(4 warnings)no-render-in-lifecycle: moverender()frombeforeEachinto individual tests (1 warning)no-container: eslint-disable for SVG with no accessible role (1 warning)Remaining 18 warnings (not fixable in this PR)
complexity— 9 warningsFunctions exceeding max cyclomatic complexity of 30. Would require significant logic refactoring with risk of introducing bugs.
src/core/field/types/image/diff/ImageFieldDiff.tsxsrc/core/form/inputs/PortableText/hooks/useTrackFocusPath.tsxsrc/core/form/inputs/ReferenceInput/ReferenceInputPreview.tsxReferenceInputPreviewsrc/core/form/inputs/ReferenceInput/ReferenceItem.tsxReferenceItemsrc/core/form/inputs/arrays/ArrayOfObjectsInput/Grid/GridItem.tsxGridItemsrc/core/form/inputs/arrays/ArrayOfObjectsInput/List/PreviewItem.tsxPreviewItemsrc/core/releases/tool/overview/ReleasesOverview.tsxReleasesOverviewsrc/core/studio/components/navbar/search/contexts/search/reducer.tssearchReducersrc/structure/documentActions/PublishAction.tsxreact-hooks/incompatible-library— 7 warningsTanStack Table / virtualization libraries return functions that can't be memoized safely by React Compiler. Not fixable in userland.
src/core/components/commandList/CommandList.tsxsrc/core/form/inputs/arrays/.../VirtualizedArrayList.tsxsrc/core/releases/tool/components/Table/Table.tsxsrc/core/releases/tool/detail/ReleaseActivityList.tsxsrc/core/scheduled-publishing/tool/schedules/VirtualList.tsxsrc/structure/panes/documentList/sheetList/DocumentSheetListPane.tsxsrc/structure/panes/documentList/sheetList/__tests__/ColumnsControl.test.tsxreact-hooks/todo— 2 warningsReact compiler doesn't yet support
UpdateExpressionon globals (syncRenders++). Awaiting compiler support.src/core/util/__tests__/createHookFromObservableFactory.test.tsxclass-methods-use-this— 1 warningBase class
validate()method that throws "must be implemented by extending class". Usingthiswould be incorrect here — it's an intentional design pattern.packages/@sanity/schema/src/legacy/Rule.ts