react-native-reanimated icon indicating copy to clipboard operation
react-native-reanimated copied to clipboard

feat: Eslint rules to ensure logger usage instead of console

Open MatiPl01 opened this issue 6 months ago • 0 comments

Summary

This PR adds 3 different eslint rules to ensure that errors and warnings are logged properly:

  • use-logger - shows error when console.warn or console.error is used instead of a proper method from the logger object,
  • wrong-logger-import - ensures that a local logger implementation is used in the package, e.g. reanimated uses logger from the reanimated package and worklets use package from the worklets package,
  • no-logger-message-prefix - shows error when the user adds a [Worklets] or [Reanimated] prefix in the log message string (this prefix is added automatically by the logger)

Error examples

use-logger

Screenshot 2025-06-24 at 17 35 04

no-logger-message-prefix

For plain string

Screenshot 2025-06-24 at 17 35 18

For template string literal

Screenshot 2025-06-24 at 17 34 39

wrong-logger-import

Screenshot 2025-06-24 at 18 17 53

MatiPl01 avatar Jun 24 '25 15:06 MatiPl01