Repository navigation
feat(packages/sui-decorators): Create @Deprecated() decorator - #1785
Merged
Merged
Conversation
oriolpuig
requested review from
andresz1,
carlosvillu,
kikoruiz and
sui-bot
as code owners
July 3, 2024 17:24
carlosvillu
approved these changes
Jul 22, 2024
…thod runs on classes
oriolpuig
force-pushed
the
poc/create_new_deprecated_decorator
branch
from
July 24, 2024 12:40
8e7ad0d to
5b9ee47
Compare
…ning on Classes, Methods and Ar
AgonisticKatai
approved these changes
Jul 24, 2024
andresz1
approved these changes
Jul 25, 2024
jordevo
approved these changes
Jul 25, 2024
jordevo
approved these changes
Jul 25, 2024
nucliweb
approved these changes
Jul 25, 2024
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.
Description
Frontend Tech Community has agreed to create, use, and standardize the
@Deprecated()decorator. It will help us to manage the death code and monitor it to keep our code as clean as possible.New decorator:
@Deprecated()Imagine you are refactoring a code, or disabling a functionality. How sure you are, that your code is not being used? For those cases, if you use the
@Deprecated()decorator, you will be able to see aconsole.warnon your terminal or browser console (it's disabled on production by default).If you want to monitor the health of your code, this decorator brings you the possibility to integrate yourself into your application and send it to your desired platform.
This decorator has 2 required parameters:
key: Used to enable you the possibility of monitoring and know how many times the deprecated code has been called.message: Used to display the message into the terminal or browser console. It's enabled only fornon-productionenvironments.Linting Rules
With this Pull Request, also we will add some linting rules for this decorator to help the DX and make our life easier.
The linting rules are:
@Deprecated()decorator MUST be used only onClassesandMethods.@Deprecated()decorator MUST have akeyprovided.keywill appear with the current method/class name.@Deprecated()decorator MUST have amessageprovided.keywill appear with the current method/class name.@Deprecated()decorator, will be highlighted as a warning.Example of usage:
Example of visualisation on your Browser Console
Example
Client test ✅
Server test ✅