Skip to content
Permalink
Browse files
Docs: add class fields in func-names documentation (refs #14857) (#14908
)
  • Loading branch information
mdjermanovic committed Aug 9, 2021
1 parent ae6072b commit d234d890b383837f8e4bda0f6ce1e2a348f9835e
Showing 1 changed file with 9 additions and 2 deletions.
@@ -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() {
// ...
}())

0 comments on commit d234d89

Please sign in to comment.