mirror of
https://github.com/HackPlan/polaris-react.git
synced 2026-01-12 22:44:36 +08:00
@tmlayton as mentioned earlier, this is where we have _some_ docs around deprecation. This PR just makes it look nicer.
1.9 KiB
1.9 KiB
Console message guidelines
A console message provides developers with information that helps with debugging and maintaining code. Types of console messages include Deprecation and Recommendation.
Content guidelines
It’s important to write console messages consistently and succinctly so it’s easy for developers to scan and understand quickly. To do this, follow this general content formula (fill in the blanks):
console.[type]('[prefix] message [url]');
Pro tip: Always mention the affected component.
Selecting the right message type
- Use
warnfor messages that call for action, likeDeprecationandRecommendationmessages.
console.warn(
'Deprecation: The `title` property on Tabs has been deprecated. Use `content` instead.',
);
- For informative messages, use
info
console.info('Your project is currently using v1.8.6');
- If more than one message is necessary, wrap them with
groupandgroupEnd
console.group('Polaris');
console.info('Your project is currently using v1.18.0');
console.warn(
'Deprecation: The `title` property on Tabs has been deprecated. Use `content` instead. Read more in the v2.0.0 upgrade guide https://github.com/Shopify/polaris-react/blob/master/CHANGELOG.md#tabs-no-longer-accept-title-prop',
);
console.groupEnd();
Selecting the right prefix
- Use
Deprecationfor messages that warn developers when component APIs are in the process of being replaced. It’s important to notify developers of breaking changes ahead of their release. - Use
Recommendationfor messages that suggest actions that will optimize a developer workflow. For example, upgrading to a new version of the@shopify/polarisnpm package.
Providing next steps and a call to action
Whenever possible provide a way for the developer to fix their code and if documentation is available, link to it.
For example: Read more at [url]