From d2d500ca5dff307189b9d4161a5e7b8282557dd6 Mon Sep 17 00:00:00 2001 From: Lawrence Chou Date: Wed, 21 Nov 2018 05:12:52 +0800 Subject: [PATCH] Docs: no-console#When-Not-To-Use provides incorrect rule snippet (#11093) 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 --- docs/rules/no-console.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/rules/no-console.md b/docs/rules/no-console.md index 1c36a85f974..bc163b93755 100644 --- a/docs/rules/no-console.md +++ b/docs/rules/no-console.md @@ -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" } ]