Skip to content

Commit

Permalink
Docs: no-console#When-Not-To-Use provides incorrect rule snippet (#11093
Browse files Browse the repository at this point in the history
)

Current selector results in a warning for `console.log()` instead of `console.foobar()`. The 'unexpectd property' should be  selected with `!=`

Also, turning off "no-console" is still required to achieve "only receiving errors for console calls with unexpected property"

Add missing "no-console: off" for `When Not To Use It` snippet
  • Loading branch information
choznerol authored and platinumazure committed Nov 20, 2018
1 parent f394a1d commit d2d500c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/rules/no-console.md
Expand Up @@ -78,10 +78,11 @@ However, you might not want to manually add `eslint-disable-next-line` or `eslin
```json
{
"rules": {
"no-console": "off",
"no-restricted-syntax": [
"error",
{
"selector": "CallExpression[callee.object.name='console'][callee.property.name=/^(log|warn|error|info|trace)$/]",
"selector": "CallExpression[callee.object.name='console'][callee.property.name!=/^(log|warn|error|info|trace)$/]",
"message": "Unexpected property on console object was called"
}
]
Expand Down

0 comments on commit d2d500c

Please sign in to comment.