From d234d890b383837f8e4bda0f6ce1e2a348f9835e Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Mon, 9 Aug 2021 19:49:53 +0200 Subject: [PATCH] Docs: add class fields in func-names documentation (refs #14857) (#14908) --- docs/rules/func-names.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/rules/func-names.md b/docs/rules/func-names.md index 27b9cc20fcf..ea1ba617e54 100644 --- a/docs/rules/func-names.md +++ b/docs/rules/func-names.md @@ -17,14 +17,14 @@ This rule can enforce or disallow the use of named function expressions. This rule has a string option: * `"always"` (default) requires function expressions to have a name -* `"as-needed"` requires function expressions to have a name, if the name cannot be assigned automatically in an ES6 environment +* `"as-needed"` requires function expressions to have a name, if the name isn't assigned automatically per the ECMAScript specification. * `"never"` disallows named function expressions, except in recursive functions, where a name is needed This rule has an object option: * `"generators": "always" | "as-needed" | "never"` * `"always"` require named generators - * `"as-needed"` require named generators if the name cannot be assigned automatically in an ES6 environment. + * `"as-needed"` require named generators if the name isn't assigned automatically per the ECMAScript specification. * `"never"` disallow named generators where possible. When a value for `generators` is not provided the behavior for generator functions falls back to the base option. @@ -98,6 +98,13 @@ const cat = { meow: function() {} } +class C { + #bar = function() {}; + baz = function() {}; +} + +quux ??= function() {}; + (function bar() { // ... }())