Raw message is shown as JSON instead of showing the message text
douira opened this issue · comments
I want to report a bug.
Reproducer
This is a more general issue. Any code that triggers a sonarjs error will work. This for example:
if (true) { }
The following is printed from eslint .
:
/Users/douira/Documents/dev/sonarjs-reproduction/index.js
1:5 error Unexpected constant condition no-constant-condition
1:5 error {"message":"This always evaluates to truthy. Consider refactoring this code.","secondaryLocations":[]} sonarjs/no-gratuitous-expressions
1:11 error Empty block statement no-empty
✖ 3 problems (3 errors, 0 warnings)
.eslintrc.js
contains the following: (the recommended rules were added for reference that not all rules are broken like this)
module.exports = {
env: {
node: true,
},
root: true,
plugins: ["sonarjs"],
extends: ["plugin:sonarjs/recommended", "eslint:recommended"],
}
Expected behavior
The message itself should be printed, not the whole internal representation of it.
eslint-plugin-sonarjs version: 0.10.0
eslint version: 7.32.0
Node.js version: 14.17.6 or 16.6.2