Implement ADR 012: Replace unguarded console.warn calls with warning() helper#7592
Draft
Implement ADR 012: Replace unguarded console.warn calls with warning() helper#7592
Conversation
|
…) helper Co-authored-by: siddharthkp <1863771+siddharthkp@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Review unimplemented ADRs for ease of implementation
Implement ADR 012: Replace unguarded console.warn calls with warning() helper
Feb 25, 2026
Copilot stopped work on behalf of
siddharthkp due to an error
February 25, 2026 18:44
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.
Implements ADR 012 (Development Warnings): all
console.warn()calls in production-reachable code paths must be wrapped in__DEV__or use the existingwarning()helper (which is already__DEV__-gated and a no-op in production).Changes
Replaced bare
console.warn()calls withwarning(condition, message)in:Radio.tsx— missingnameattribute warningTextInputInnerAction.tsx— missingaria-labelwarningCheckboxOrRadioGroup.tsx— missing label/aria-labelledbywarningSegmentedControl.tsx— missingaria-label/aria-labelledbywarningutils/deprecate.tsx—Deprecations.deprecate()static method now callswarn()instead ofconsole.warn()Simplified
__DEV__-wrapped blocks that can be expressed more cleanly withwarning():Heading.tsx— removed redundantif (__DEV__)wrapper arounduseEffect;warning()handles dev-gating, eliminating the conditional hook patternFilteredActionList.tsx— collapsed__DEV__+ nestedifinto a singlewarning()callDataTable/useTable.ts— replaced 4if (__DEV__) { console.warn(...) }blocks withwarning(true, msg)Note:
ButtonBase.tsxretains itsif (__DEV__) { console.warn(...) }pattern intentionally — refactoring towarning()would surface SSR linting errors (ssr-friendly/no-dom-globals-in-react-fc) sinceHTMLButtonElement/HTMLAnchorElementare used in the render cycle. The existing pattern already satisfies ADR 012.Before:
After:
Changelog
New
Changed
console.warn()calls inRadio,TextInputInnerAction,CheckboxOrRadioGroup,SegmentedControl,Deprecations,Heading,FilteredActionList, andDataTable/useTablenow use thewarning()/warn()helpers and are stripped from production buildsRemoved
Rollout strategy
Internal refactor with no API or behavior change for consumers. Warnings only appear in development; production output is identical.
Testing & Reviewing
All affected component test suites pass (
Radio,SegmentedControl,Heading,DataTable,RadioGroup,CheckboxGroup,TextInput,utils). Development warnings continue to emit as expected (visible in test stderr output).Merge checklist
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.