Skip to content

Commit

Permalink
Forbid console logs in the app to ensure logLevel is always respected
Browse files Browse the repository at this point in the history
  • Loading branch information
JiriLojda committed Jan 19, 2024
1 parent 8298f94 commit d388dc8
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
{
"extends": [
"@kontent-ai"
],
"extends": [
"@kontent-ai"
],

"overrides": [
{
"files": ["src/**/*.ts"],
"excludedFiles": ["src/log.ts"],
"rules": {
"no-restricted-syntax": [
"error",
{
"selector": "MemberExpression[object.name='console'][property.name=/^(log|warn|error|info|trace)$/]",
"message": "Don't log into the console directly. Use one of the functions from the log.ts file (logInfo, logWarning, logError) to ensure provided --logLevel is respected."
}
]
}
}
],

"parserOptions": {
"project": ["tsconfig.json", "tsconfig.tests.jsonc", "tsconfig.configs.jsonc"]
}
Expand Down

0 comments on commit d388dc8

Please sign in to comment.